From patchwork Thu Nov 10 16:20:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ricardo Ribalda X-Patchwork-Id: 1455 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp240838wru; Thu, 10 Nov 2022 08:22:52 -0800 (PST) X-Google-Smtp-Source: AMsMyM7Xtt5pOES0YZ+TfuXegbOrunOctDEWCls8+dWqWvAyMfVXgiuP6x9PVeaIAIJY6ML6bTOW X-Received: by 2002:a05:6a00:3698:b0:56d:3180:e88f with SMTP id dw24-20020a056a00369800b0056d3180e88fmr62482277pfb.66.1668097371736; Thu, 10 Nov 2022 08:22:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668097371; cv=none; d=google.com; s=arc-20160816; b=feVHEI6LOKqCAgSf1UZqGg+Np9DsMibL+gelVdbmFfQSILnFvoIKVOywFJ3u3NuIIv eaojv3zAVAG6s/HKNFPoAEnCRbF0es3JBlXWnfm6W68Sw3LqgU737bLauYpmb1o50x0W B8Q5sBY+9Z0bKPniVuY/p/yRIqtqDp9F93HOZEfzDdyN0O6t36tsywUThwJumnX5hS3C DJVKYCIEPdo/kBIJ/chL3P3ijo2p/RVjVdsUAJPN9uXajG7sDYsgEKnPcj4+m6QxkC2l PokNu7GzGWgw6ZjyhpcUOZ3topHeRywaJIqf32JT+Swe25kthvxCyjDTd5BhoGLifOl6 xYFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:message-id:date:from :content-transfer-encoding:mime-version:subject:dkim-signature; bh=DeTQBsnVil4skLVb0JTYA0ze/q8Y7Qzt3eBgeJWs+Xo=; b=ss4nGajxLEEmWEm3OrhBbc4ZF22bl215GfIuTExGC/Ryh2+gZJO2xg9GSqHzV+EqfV g5B4vPsu3p/UffCmSpJIwwccj33rM9XYGKad2szVyWm2PZTZAMFOZLB/mNiv6SFav2yV Hq9+D+8aRffcmndysaRaauP+NInQHRtq4ZDXzl+FVJOkXcp9t6P4HLAWXqimDfs0O6Bg YtZ+VMmSE3VE98r/KneVvPZeTzHvCodVCmK/606Bk/FPCsAJB6M/s9tYPCANAYB7ooMm /HY1/vTfOtB3jOUFm/7rFME8OFrECiHDDsYdqcjpIlOSRMZA7eE8RppT5+6Eic/SeE+K Nb7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GKJkmTIU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a056a00231200b00562a1693523si21976152pfh.20.2022.11.10.08.22.36; Thu, 10 Nov 2022 08:22:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GKJkmTIU; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231214AbiKJQU4 (ORCPT + 99 others); Thu, 10 Nov 2022 11:20:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230506AbiKJQUy (ORCPT ); Thu, 10 Nov 2022 11:20:54 -0500 Received: from mail-ej1-x631.google.com (mail-ej1-x631.google.com [IPv6:2a00:1450:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 977A91A052 for ; Thu, 10 Nov 2022 08:20:52 -0800 (PST) Received: by mail-ej1-x631.google.com with SMTP id t25so6242891ejb.8 for ; Thu, 10 Nov 2022 08:20:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:from:to:cc:subject:date:message-id:reply-to; bh=DeTQBsnVil4skLVb0JTYA0ze/q8Y7Qzt3eBgeJWs+Xo=; b=GKJkmTIUnrs5ihbdB9mi5Xs1cdxoZafh9Hi5mwHvDqnRpzX1Kv7B2F0E7otQXIbQaw drCybDDsVpM3uH8w2nuxWkc14OrMf1+ciOQQI0ya/CoWunaxOxkN3hPVHCNtlnue2gFk 52fMkaORsXWbzseWYaPLOVKIDJcfT2ricES00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:message-id:date:from:content-transfer-encoding:mime-version :subject:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=DeTQBsnVil4skLVb0JTYA0ze/q8Y7Qzt3eBgeJWs+Xo=; b=i4r5B6aAsiquKTzu6BSzK8xjan1DfsWHj0xK3CEEfNjRUk1uUny9CY4J5J8wTw25m6 Jo4SxUpG/A6zu0RPa28QdsPULR7cyzD4kh2bmAqnKiXaOqSGZQZwTcw1UtLij3OK4J04 N8h8zkXAGiLSbXivqU2BxuKsywMUMYjy0x0hO9wkb3eaP1WkgfG8seBmQHqE94FENEb6 vVWhdJt481+0BtvFu8CV2ctfGwckzS1UaHTh5C5sGJ0Ut4vcMosQ+omRnBYVtE9YCr5V Xz9Nh2/pRGtR3KpD00gAxRYP7Bne/PpeShIez8FEo8Cyx4lAs7c/1KTu6AAK10rzZ+KT 2Vbg== X-Gm-Message-State: ACrzQf2Env19wjLKO/KDpuULHigZzClHtZ4WiQpAeOMkw7+suA6/ZGm9 B+7iiu8fnlS0qqHMUu/kEBPSmw== X-Received: by 2002:a17:906:8b81:b0:7ad:93d1:5eae with SMTP id nr1-20020a1709068b8100b007ad93d15eaemr62378695ejc.29.1668097251178; Thu, 10 Nov 2022 08:20:51 -0800 (PST) Received: from alco.roam.corp.google.com (80.71.134.83.ipv4.parknet.dk. [80.71.134.83]) by smtp.gmail.com with ESMTPSA id e8-20020a170906314800b0077b2b0563f4sm7510193eje.173.2022.11.10.08.20.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 08:20:50 -0800 (PST) Subject: [PATCH v5 0/1] i2c: Restore power status of device if probe fail or device is removed MIME-Version: 1.0 X-b4-tracking: H4sIANYkbWMC/3XOzQ6CMAwH8FcxOzuzjQ2YJ9/DeNhHgSXAkk1mDOHdrR4NnJo2/f3blWRIATK5nl aSoIQc4oyNOp+IG8zcAw0eeyKYEJwzTYNw9GVCAWpANx0Y3nGrCO5bk4HaZGY3oJiXccThEPIzpvcv v3As972owimj4BtmtLZaM39zQ4pTWKZLTD15YFARh1ggZo1SzHbCG+d2cHWIK8S+rRV3Vtq23bssD7 H8vi2lrmUt2qqyf3jbtg/GVtNkYQEAAA== From: Ricardo Ribalda Date: Thu, 10 Nov 2022 17:20:38 +0100 Message-Id: <20221109-i2c-waive-v5-0-2839667f8f6a@chromium.org> To: Wolfram Sang , Tomasz Figa , "Rafael J. Wysocki" Cc: Hidenori Kobayashi , stable@vger.kernel.org, linux-i2c@vger.kernel.org, Ricardo Ribalda , Sergey Senozhatsky , Sakari Ailus , linux-kernel@vger.kernel.org X-Mailer: b4 0.11.0-dev-d93f8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1794; i=ribalda@chromium.org; h=from:subject:message-id; bh=4clQAZaLvuRcOY86HZLxZyhWxEsEPqsm3+62UqWakNo=; b=owEBbQKS/ZANAwAKAdE30T7POsSIAcsmYgBjbSTY+Kf+2Fhq4xTRwy1lq5DVpEm/1XKcBs3SBnbD PPrVTMaJAjMEAAEKAB0WIQREDzjr+/4oCDLSsx7RN9E+zzrEiAUCY20k2AAKCRDRN9E+zzrEiPEZD/ 9qBU465i41cAV/uiiHV6bOJFvKo8YJXGpn6qLRZaJFt+tP6IIh1WXuPblF38hOKMfF0V3FE115nk/1 1qUdUX3UdHWsM9mtXdvS9uhoJTTJRC2H/0jSsY3etzA9nGlcRL3thGo5RMW4JsA+3QJhhv5xCshMoZ A6CAJkGJpKnodStNfMO2/WtpsrIeMDMIq3p1cbCosxgvG+D1+upNle++lncnzl2Li5TNT+Zhtd3lmz 9iSjuzMNwICb+15q1SIdhaGLEUQIK/0Gjhsewq8KI9uzaCmYQ852WTmnvKCpxbG0DVAe0ieTKOtBd8 OxD0h5zp2B4w7l/fdG+fHIwH62+2c5vO9mdvBFQNR9uKPDhOJ8zN5alyJ+Gn76cMzXGICbw9HkJ9m2 Q5Jg6h/8eFj3Fp+1kTZz9nPGi4WjIIS6PP5dWSzkDkxXGaJ+EBo8xeX5DMNo3maBv1xcRzjnxTsXXK 0MYWyxifouuDaOdabiU+mdmLDGfnZsPi+XjKDgJW3qrEmrM7uYNrF2FIpY6hO+pQrs59uz+PFVHlvS Z2yoAxZBjrL0sdahub533nPRvvI/0wXC61UaGwcR9Kj+Rqf3IivTPYE8FzHXXDxKA9nv1+Eu8TlVVq Vv7okpeMb4/zPyQUpG/KoixIyKAL/Qqcffj/GauplsZV5BSSH9v+neknhj6g== X-Developer-Key: i=ribalda@chromium.org; a=openpgp; fpr=9EC3BB66E2FC129A6F90B39556A0D81F9F782DA9 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749105231281099171?= X-GMAIL-MSGID: =?utf-8?q?1749126869736168232?= We have discovered that some power lines were always on even if the devices on that power line was not used. This happens because we failed to probe a device on the i2c bus, and the ACPI Power Resource were never turned off. This patch tries to fix this issue. To: Wolfram Sang To: Sakari Ailus To: Tomasz Figa To: "Rafael J. Wysocki" Cc: Hidenori Kobayashi Cc: Sergey Senozhatsky Cc: linux-i2c@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: stable@vger.kernel.org Signed-off-by: Ricardo Ribalda --- Changes in v5: - Add Cc: stable - Add Reviewed-by Sakary (Thanks!) - Renamed turn-off as power-off, in the name of consistency (Thanks Sergey!) - Link to v4: https://lore.kernel.org/r/20221109-i2c-waive-v4-0-e4496462833b@chromium.org Changes in v4: - Rename full_power to do_power_on - Link to v3: https://lore.kernel.org/r/20221109-i2c-waive-v3-0-d8651cb4b88d@chromium.org Changes in v3: - Introduce full_power variable to make more clear what we are doing. - Link to v2: https://lore.kernel.org/r/20221109-i2c-waive-v2-0-07550bf2dacc@chromium.org Changes in v2: - Cover also device remove - Link to v1: https://lore.kernel.org/r/20221109-i2c-waive-v1-0-ed70a99b990d@chromium.org --- Ricardo Ribalda (1): i2c: Restore initial power state when we are done. drivers/i2c/i2c-core-base.c | 11 +++++++---- include/linux/i2c.h | 4 ++++ 2 files changed, 11 insertions(+), 4 deletions(-) --- base-commit: f141df371335645ce29a87d9683a3f79fba7fd67 change-id: 20221109-i2c-waive-ae97fea1f1b5 Best regards,