| From 0710f2d0780f9d8419249d7f70d4f534bb216952 Mon Sep 17 00:00:00 2001 |
| From: Tzung-Bi Shih <tzungbi@chromium.org> |
| Date: Mon, 7 Oct 2024 08:48:55 +0000 |
| Subject: [PATCH] Reland "CHROMIUM: i2c: Add device property for probing" |
| |
| This reverts commit 8cd794f66852e6905ba924e8ec5570b54d605120. |
| |
| Reason for revert: b/371469463 |
| |
| Original change's description: |
| > Revert "CHROMIUM: i2c: Add device property for probing" |
| > |
| > This reverts commit a0b66ad49ac2a0c05142020d71f212f0c7e3648e. |
| > |
| > See also b/359325803#comment2. |
| > |
| > BUG=b:359325803 |
| > BUG=b:356796582 |
| > BUG=b:285134532 |
| > TEST=CQ |
| > |
| > Change-Id: I524ba64b72b6a2714897f711d474ddf173e67c32 |
| > Signed-off-by: Tzung-Bi Shih <tzungbi@chromium.org> |
| > Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5902959 |
| > Reviewed-by: Dmitry Torokhov <dtor@chromium.org> |
| |
| BUG=b:371469463 |
| BUG=b:359325803 |
| BUG=b:356796582 |
| BUG=b:285134532 |
| |
| Change-Id: If47461deb9310e0b5c60f9036d93ec054cca9422 |
| Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/5905677 |
| Commit-Queue: Tzung-Bi Shih <tzungbi@chromium.org> |
| Tested-by: Tzung-Bi Shih <tzungbi@chromium.org> |
| Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com> |
| --- |
| drivers/i2c/i2c-core-acpi.c | 12 +++++++++++- |
| drivers/i2c/i2c-core-of.c | 10 +++++++++- |
| 2 files changed, 20 insertions(+), 2 deletions(-) |
| |
| diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c |
| index 14ae0cfc325efbeb38e52707bf3bc5f4c7dd90c7..e34929475afbf336d2bfbe7b1508fa8db069a9d5 100644 |
| --- a/drivers/i2c/i2c-core-acpi.c |
| +++ b/drivers/i2c/i2c-core-acpi.c |
| @@ -278,6 +278,8 @@ static void i2c_acpi_register_device(struct i2c_adapter *adapter, |
| struct acpi_device *adev, |
| struct i2c_board_info *info) |
| { |
| + struct i2c_client *client; |
| + |
| /* |
| * Skip registration on boards where the ACPI tables are |
| * known to contain bogus I2C devices. |
| @@ -288,7 +290,15 @@ static void i2c_acpi_register_device(struct i2c_adapter *adapter, |
| adev->power.flags.ignore_parent = true; |
| acpi_device_set_enumerated(adev); |
| |
| - if (IS_ERR(i2c_new_client_device(adapter, info))) |
| + if (!acpi_dev_get_property(adev, "linux,probed", ACPI_TYPE_ANY, NULL)) { |
| + unsigned short addrs[] = { info->addr, I2C_CLIENT_END }; |
| + |
| + client = i2c_new_scanned_device(adapter, info, addrs, NULL); |
| + } else { |
| + client = i2c_new_client_device(adapter, info); |
| + } |
| + |
| + if (IS_ERR(client)) |
| adev->power.flags.ignore_parent = false; |
| } |
| |
| diff --git a/drivers/i2c/i2c-core-of.c b/drivers/i2c/i2c-core-of.c |
| index a6c407d3680098272a341de84269ef036e302279..16594a0b29253fdd2a67d4002309a91247578f96 100644 |
| --- a/drivers/i2c/i2c-core-of.c |
| +++ b/drivers/i2c/i2c-core-of.c |
| @@ -75,7 +75,15 @@ static struct i2c_client *of_i2c_register_device(struct i2c_adapter *adap, |
| if (ret) |
| return ERR_PTR(ret); |
| |
| - client = i2c_new_client_device(adap, &info); |
| + /* Allow device property to enable probing before init */ |
| + if (of_get_property(node, "linux,probed", NULL)) { |
| + unsigned short addrs[] = { info.addr, I2C_CLIENT_END }; |
| + |
| + client = i2c_new_scanned_device(adap, &info, addrs, NULL); |
| + } else { |
| + client = i2c_new_client_device(adap, &info); |
| + } |
| + |
| if (IS_ERR(client)) |
| dev_err(&adap->dev, "of_i2c: Failure registering %pOF\n", node); |
| |
| -- |
| 2.47.0.199.ga7371fff76-goog |
| |