{"id":2212516,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2212516/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20260318084621.4127757-2-adlavinitha.reddy@mediatek.com/","project":{"id":35,"url":"http://patchwork.ozlabs.org/api/1.2/projects/35/?format=json","name":"Linux I2C development","link_name":"linux-i2c","list_id":"linux-i2c.vger.kernel.org","list_email":"linux-i2c@vger.kernel.org","web_url":"","scm_url":"","webscm_url":"","list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260318084621.4127757-2-adlavinitha.reddy@mediatek.com>","list_archive_url":null,"date":"2026-03-18T08:46:16","name":"[v1,1/1] i2c: mediatek: add bus regulator control for power saving","commit_ref":null,"pull_url":null,"state":"accepted","archived":false,"hash":"8612ae7cb3cc350524419d62fd3c657d554a2e82","submitter":{"id":92899,"url":"http://patchwork.ozlabs.org/api/1.2/people/92899/?format=json","name":"adlavinitha reddy","email":"adlavinitha.reddy@mediatek.com"},"delegate":{"id":149066,"url":"http://patchwork.ozlabs.org/api/1.2/users/149066/?format=json","username":"cazzacarna","first_name":"Andi","last_name":"Shyti","email":"andi.shyti@kernel.org"},"mbox":"http://patchwork.ozlabs.org/project/linux-i2c/patch/20260318084621.4127757-2-adlavinitha.reddy@mediatek.com/mbox/","series":[{"id":496419,"url":"http://patchwork.ozlabs.org/api/1.2/series/496419/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-i2c/list/?series=496419","date":"2026-03-18T08:46:15","name":"i2c: mediatek: add bus regulator control for power saving","version":1,"mbox":"http://patchwork.ozlabs.org/series/496419/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2212516/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2212516/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-i2c+bounces-16565-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-i2c@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=mediatek.com header.i=@mediatek.com header.a=rsa-sha256\n header.s=dk header.b=toI8xKgU;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c09:e001:a7::12fc:5321; helo=sto.lore.kernel.org;\n envelope-from=linux-i2c+bounces-16565-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com\n header.b=\"toI8xKgU\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=60.244.123.138","smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=mediatek.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=mediatek.com"],"Received":["from sto.lore.kernel.org (sto.lore.kernel.org\n [IPv6:2600:3c09:e001:a7::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fbMrQ2rDMz1y1h\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Mar 2026 19:46:46 +1100 (AEDT)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sto.lore.kernel.org (Postfix) with ESMTP id CA5C6301629E\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 18 Mar 2026 08:46:39 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id B78DC38F957;\n\tWed, 18 Mar 2026 08:46:33 +0000 (UTC)","from mailgw01.mediatek.com (unknown [60.244.123.138])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id DCBB338F24F;\n\tWed, 18 Mar 2026 08:46:31 +0000 (UTC)","from mtkmbs11n2.mediatek.inc [(172.21.101.187)] by\n mailgw01.mediatek.com\n\t(envelope-from <adlavinitha.reddy@mediatek.com>)\n\t(Generic MTA with TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384 256/256)\n\twith ESMTP id 368408986; Wed, 18 Mar 2026 16:46:26 +0800","from mtkmbs13n1.mediatek.inc (172.21.101.193) by\n mtkmbs13n2.mediatek.inc (172.21.101.108) with Microsoft SMTP Server\n (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id\n 15.2.2562.29; Wed, 18 Mar 2026 16:46:24 +0800","from mtksitap99.mediatek.inc (10.233.130.16) by\n mtkmbs13n1.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id\n 15.2.2562.29 via Frontend Transport; Wed, 18 Mar 2026 16:46:24 +0800"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1773823593; cv=none;\n b=jlwnZXgyzGlPkjOdNjXfvwOsohOEAweoGCZwq/+/uKBXjQotbBnHG8nq6wfVVusO7ag87772tGe4wmDmlyIQPNCZMWwBjwxFTEHo1L1F4t58J3OCkoBPDm/zSVgvyEefHAur05TWwl2QivhcQNilyCMo6n3Jsggs7xKUfmhOI8E=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1773823593; c=relaxed/simple;\n\tbh=mjXXuIHewfu+iEaT2xOPWa/ssz2EyIZUkW84O7ZF4JE=;\n\th=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version:Content-Type;\n b=F2PW4J8US6x8j0MNR6usUVWkFjR+4louliuW+LXIrBJY9ozQjWp9bRYnwnKsvxZeqvrEfflzAbA3+Pj/upy8PH99+X6ixjp1D31lBZsMQxe9OP88RJ1Ty29tLOK/+53uLoQCECeQCwhS+VOU6PQjhmWyV4Jgk7BuToOAgCn60CM=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=quarantine dis=none) header.from=mediatek.com;\n spf=pass smtp.mailfrom=mediatek.com;\n dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com\n header.b=toI8xKgU; arc=none smtp.client-ip=60.244.123.138","X-UUID":["f2e5bdb222a611f1a02d4725871ece0b-20260318","f2e5bdb222a611f1a02d4725871ece0b-20260318"],"DKIM-Signature":"v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;\n d=mediatek.com; s=dk;\n\th=Content-Type:Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From;\n bh=jNAxvMlpKbnk3xa//SsNLWzTbu90yHBu0yVq6XBO01c=;\n\tb=toI8xKgU2WD1t7OZU/WLbYxyU9Urz1RDYoaA9HO1DNvwkhLlP771UG/nPjdG5zJAZZZIwpHh4g0/KcxD4utzAW4rplZlgLY3+e5AqYD9lULknxZYNfsemt9KWKtoJwaXksWJ5MTWsTXp28461lEcoapikLOToe9D19f4ByWl8fE=;","X-CID-CACHE":"Type:Local,Time:202603181611+08,HitQuantity:1","X-CID-P-RULE":"Release_Ham","X-CID-O-INFO":"VERSION:1.3.12,REQID:66e843d1-788b-4b4c-9c15-f4e5fab99e76,IP:0,U\n\tRL:0,TC:0,Content:-5,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION\n\t:release,TS:-5","X-CID-META":"VersionHash:e7bac3a,CLOUDID:8321ef93-f8ef-4ca8-bea0-143568f9ca1d,B\n\tulkID:nil,BulkQuantity:0,Recheck:0,SF:81|82|102|836|888|898,TC:-5,Content:\n\t0|15|50,EDM:-3,IP:nil,URL:0,File:130,RT:0,Bulk:nil,QS:nil,BEC:-1,COL:0,OSI\n\t:0,OSA:0,AV:0,LES:1,SPR:NO,DKR:0,DKP:0,BRR:0,BRE:0,ARC:0","X-CID-BVR":"2,SSN|SDN","X-CID-BAS":"2,SSN|SDN,0,_","X-CID-FACTOR":"TF_CID_SPAM_SNR","X-CID-RHF":"D41D8CD98F00B204E9800998ECF8427E","From":"adlavinitha reddy <adlavinitha.reddy@mediatek.com>","To":"Qii Wang <qii.wang@mediatek.com>, Andi Shyti <andi.shyti@kernel.org>,\n\tMatthias Brugger <matthias.bgg@gmail.com>, AngeloGioacchino Del Regno\n\t<angelogioacchino.delregno@collabora.com>","CC":"<linux-i2c@vger.kernel.org>, <linux-kernel@vger.kernel.org>,\n\t<linux-arm-kernel@lists.infradead.org>, <linux-mediatek@lists.infradead.org>,\n\t<Project_Global_Chrome_Upstream_Group@mediatek.com>, adlavinitha reddy\n\t<adlavinitha.reddy@mediatek.com>","Subject":"[v1,PATCH 1/1] i2c: mediatek: add bus regulator control for power\n saving","Date":"Wed, 18 Mar 2026 16:46:16 +0800","Message-ID":"<20260318084621.4127757-2-adlavinitha.reddy@mediatek.com>","X-Mailer":"git-send-email 2.45.2","In-Reply-To":"<20260318084621.4127757-1-adlavinitha.reddy@mediatek.com>","References":"<20260318084621.4127757-1-adlavinitha.reddy@mediatek.com>","Precedence":"bulk","X-Mailing-List":"linux-i2c@vger.kernel.org","List-Id":"<linux-i2c.vger.kernel.org>","List-Subscribe":"<mailto:linux-i2c+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-i2c+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","Content-Type":"text/plain","X-MTK":"N"},"content":"Add conditional bus regulator enable/disable in mtk_i2c_transfer()\nto support I2C bus power gating for platforms that require it.\n\nThis implementation:\n- Enables bus_regulator before clk_bulk_enable() if vbus-supply is defined\n- Disables bus_regulator after clk_bulk_disable()\n- Only activates when vbus-supply is provided in device tree\n- Has no impact on platforms without vbus-supply defined\n\nThis approach provides power savinggs for platforms with an extra I2C bus\nregulator, while avoiding runtime PM complexity.\n\nTEST= Build and boot on MT8188\n\nSigned-off-by: adlavinitha reddy <adlavinitha.reddy@mediatek.com>\n---\n drivers/i2c/busses/i2c-mt65xx.c | 13 ++++++++++++-\n 1 file changed, 12 insertions(+), 1 deletion(-)\n\n--\n2.45.2","diff":"diff --git a/drivers/i2c/busses/i2c-mt65xx.c b/drivers/i2c/busses/i2c-mt65xx.c\nindex cb4d3aa709d0..126040ca05f1 100644\n--- a/drivers/i2c/busses/i2c-mt65xx.c\n+++ b/drivers/i2c/busses/i2c-mt65xx.c\n@@ -21,6 +21,7 @@\n #include <linux/module.h>\n #include <linux/of.h>\n #include <linux/platform_device.h>\n+#include <linux/regulator/consumer.h>\n #include <linux/scatterlist.h>\n #include <linux/sched.h>\n #include <linux/slab.h>\n@@ -1244,9 +1245,15 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,\n \tbool write_then_read_en = false;\n \tstruct mtk_i2c *i2c = i2c_get_adapdata(adap);\n\n+\tif (i2c->adap.bus_regulator) {\n+\t\tret = regulator_enable(i2c->adap.bus_regulator);\n+\t\tif (ret)\n+\t\t\treturn ret;\n+\t}\n+\n \tret = clk_bulk_enable(I2C_MT65XX_CLK_MAX, i2c->clocks);\n \tif (ret)\n-\t\treturn ret;\n+\t\tgoto err_regulator;\n\n \ti2c->auto_restart = i2c->dev_comp->auto_restart;\n\n@@ -1301,6 +1308,10 @@ static int mtk_i2c_transfer(struct i2c_adapter *adap,\n\n err_exit:\n \tclk_bulk_disable(I2C_MT65XX_CLK_MAX, i2c->clocks);\n+err_regulator:\n+\tif (i2c->adap.bus_regulator)\n+\t\tregulator_disable(i2c->adap.bus_regulator);\n+\n \treturn ret;\n }\n\n","prefixes":["v1","1/1"]}