This reverts commit 6fe12cdbcfe35ad4726a619a9546822d34fc934c. Testing in linux-next showed it needs some more time.
Unified · Split
| @@ -313,14 +313,12 @@ static int i2c_smbus_host_notify_to_irq(const struct i2c_client *client) · 312 unmodified lines | ||
| 313 | 313 | static int i2c_device_probe(struct device *dev) |
| 314 | 314 | { |
| 315 | 315 | struct i2c_client *client = i2c_verify_client(dev); |
| 316 | − struct i2c_adapter *adap; | |
| 317 | 316 | struct i2c_driver *driver; |
| 318 | 317 | int status; |
| 319 | 318 | |
| 320 | 319 | if (!client) |
| 321 | 320 | return 0; |
| 322 | 321 | |
| 323 | − adap = client->adapter; | |
| 324 | 322 | driver = to_i2c_driver(dev->driver); |
| 325 | 323 | |
| 326 | 324 | client->irq = client->init_irq; |
| @@ -386,12 +384,6 @@ static int i2c_device_probe(struct device *dev) · 59 unmodified lines | ||
| 386 | 384 | |
| 387 | 385 | dev_dbg(dev, "probe\n"); |
| 388 | 386 | |
| 389 | − status = regulator_enable(adap->bus_regulator); | |
| 390 | − if (status < 0) { | |
| 391 | − dev_err(&adap->dev, "Failed to enable power regulator\n"); | |
| 392 | − goto err_clear_wakeup_irq; | |
| 393 | − } | |
| 394 | − | |
| 395 | 387 | status = of_clk_set_defaults(dev->of_node, false); |
| 396 | 388 | if (status < 0) |
| 397 | 389 | goto err_clear_wakeup_irq; |
| @@ -432,14 +424,12 @@ put_sync_adapter: · 34 unmodified lines | ||
| 432 | 424 | static int i2c_device_remove(struct device *dev) |
| 433 | 425 | { |
| 434 | 426 | struct i2c_client *client = i2c_verify_client(dev); |
| 435 | − struct i2c_adapter *adap; | |
| 436 | 427 | struct i2c_driver *driver; |
| 437 | 428 | int status = 0; |
| 438 | 429 | |
| 439 | 430 | if (!client || !dev->driver) |
| 440 | 431 | return 0; |
| 441 | 432 | |
| 442 | − adap = client->adapter; | |
| 443 | 433 | driver = to_i2c_driver(dev->driver); |
| 444 | 434 | if (driver->remove) { |
| 445 | 435 | dev_dbg(dev, "remove\n"); |
| @@ -447,8 +437,6 @@ static int i2c_device_remove(struct device *dev) · 1 unmodified line | ||
| 447 | 437 | } |
| 448 | 438 | |
| 449 | 439 | dev_pm_domain_detach(&client->dev, true); |
| 450 | − if (!pm_runtime_status_suspended(&client->dev)) | |
| 451 | − regulator_disable(adap->bus_regulator); | |
| 452 | 440 | |
| 453 | 441 | dev_pm_clear_wake_irq(&client->dev); |
| 454 | 442 | device_init_wakeup(&client->dev, false); |
| @@ -460,72 +448,6 @@ static int i2c_device_remove(struct device *dev) · 5 unmodified lines | ||
| 460 | 448 | return status; |
| 461 | 449 | } |
| 462 | 450 | |
| 463 | −#ifdef CONFIG_PM_SLEEP | |
| 464 | −static int i2c_resume_early(struct device *dev) | |
| 465 | −{ | |
| 466 | − struct i2c_client *client = i2c_verify_client(dev); | |
| 467 | − struct i2c_adapter *adap = client->adapter; | |
| 468 | − int err; | |
| 469 | − | |
| 470 | − if (!pm_runtime_status_suspended(&client->dev)) { | |
| 471 | − err = regulator_enable(adap->bus_regulator); | |
| 472 | − if (err) | |
| 473 | − return err; | |
| 474 | − } | |
| 475 | − | |
| 476 | − return pm_generic_resume_early(&client->dev); | |
| 477 | −} | |
| 478 | − | |
| 479 | −static int i2c_suspend_late(struct device *dev) | |
| 480 | −{ | |
| 481 | − struct i2c_client *client = i2c_verify_client(dev); | |
| 482 | − struct i2c_adapter *adap = client->adapter; | |
| 483 | − int err; | |
| 484 | − | |
| 485 | − err = pm_generic_suspend_late(&client->dev); | |
| 486 | − if (err) | |
| 487 | − return err; | |
| 488 | − | |
| 489 | − if (!pm_runtime_status_suspended(&client->dev)) | |
| 490 | − return regulator_disable(adap->bus_regulator); | |
| 491 | − | |
| 492 | − return 0; | |
| 493 | −} | |
| 494 | −#endif | |
| 495 | − | |
| 496 | −#ifdef CONFIG_PM | |
| 497 | −static int i2c_runtime_resume(struct device *dev) | |
| 498 | −{ | |
| 499 | − struct i2c_client *client = i2c_verify_client(dev); | |
| 500 | − struct i2c_adapter *adap = client->adapter; | |
| 501 | − int err; | |
| 502 | − | |
| 503 | − err = regulator_enable(adap->bus_regulator); | |
| 504 | − if (err) | |
| 505 | − return err; | |
| 506 | − | |
| 507 | − return pm_generic_runtime_resume(&client->dev); | |
| 508 | −} | |
| 509 | − | |
| 510 | −static int i2c_runtime_suspend(struct device *dev) | |
| 511 | −{ | |
| 512 | − struct i2c_client *client = i2c_verify_client(dev); | |
| 513 | − struct i2c_adapter *adap = client->adapter; | |
| 514 | − int err; | |
| 515 | − | |
| 516 | − err = pm_generic_runtime_suspend(&client->dev); | |
| 517 | − if (err) | |
| 518 | − return err; | |
| 519 | − | |
| 520 | − return regulator_disable(adap->bus_regulator); | |
| 521 | −} | |
| 522 | −#endif | |
| 523 | − | |
| 524 | −static const struct dev_pm_ops i2c_device_pm = { | |
| 525 | − SET_LATE_SYSTEM_SLEEP_PM_OPS(i2c_suspend_late, i2c_resume_early) | |
| 526 | − SET_RUNTIME_PM_OPS(i2c_runtime_suspend, i2c_runtime_resume, NULL) | |
| 527 | −}; | |
| 528 | − | |
| 529 | 451 | static void i2c_device_shutdown(struct device *dev) |
| 530 | 452 | { |
| 531 | 453 | struct i2c_client *client = i2c_verify_client(dev); |
| @@ -583,7 +505,6 @@ struct bus_type i2c_bus_type = { · 51 unmodified lines | ||
| 583 | 505 | .probe = i2c_device_probe, |
| 584 | 506 | .remove = i2c_device_remove, |
| 585 | 507 | .shutdown = i2c_device_shutdown, |
| 586 | − .pm = &i2c_device_pm, | |
| 587 | 508 | }; |
| 588 | 509 | EXPORT_SYMBOL_GPL(i2c_bus_type); |
| 589 | 510 | |
| @@ -1422,11 +1343,6 @@ static int i2c_register_adapter(struct i2c_adapter *adap) · 832 unmodified lines | ||
| 1422 | 1343 | if (res) |
| 1423 | 1344 | goto out_reg; |
| 1424 | 1345 | |
| 1425 | − adap->bus_regulator = devm_regulator_get(&adap->dev, "bus"); | |
| 1426 | − if (IS_ERR(adap->bus_regulator)) { | |
| 1427 | − res = PTR_ERR(adap->bus_regulator); | |
| 1428 | − goto out_reg; | |
| 1429 | − } | |
| 1430 | 1346 | dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name); |
| 1431 | 1347 | |
| 1432 | 1348 | pm_runtime_no_callbacks(&adap->dev); |
| @@ -15,7 +15,6 @@ · 14 unmodified lines | ||
| 15 | 15 | #include <linux/device.h> /* for struct device */ |
| 16 | 16 | #include <linux/sched.h> /* for completion */ |
| 17 | 17 | #include <linux/mutex.h> |
| 18 | −#include <linux/regulator/consumer.h> | |
| 19 | 18 | #include <linux/rtmutex.h> |
| 20 | 19 | #include <linux/irqdomain.h> /* for Host Notify IRQ */ |
| 21 | 20 | #include <linux/of.h> /* for struct device_node */ |
| @@ -716,7 +715,6 @@ struct i2c_adapter { · 694 unmodified lines | ||
| 716 | 715 | const struct i2c_adapter_quirks *quirks; |
| 717 | 716 | |
| 718 | 717 | struct irq_domain *host_notify_domain; |
| 719 | − struct regulator *bus_regulator; | |
| 720 | 718 | }; |
| 721 | 719 | #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) |
| 722 | 720 | |