Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2196303/?format=api
{ "id": 2196303, "url": "http://patchwork.ozlabs.org/api/patches/2196303/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20260213-i2c-mux-v5-2-fb2cbf9979b3@gmail.com/", "project": { "id": 35, "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api", "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": "<20260213-i2c-mux-v5-2-fb2cbf9979b3@gmail.com>", "list_archive_url": null, "date": "2026-02-13T11:06:51", "name": "[v5,2/5] i2c: mux: add support for per channel bus frequency", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "5de31128f5224e7543ad10b2097a388f9a9656a6", "submitter": { "id": 46679, "url": "http://patchwork.ozlabs.org/api/people/46679/?format=api", "name": "Marcus Folkesson", "email": "marcus.folkesson@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/20260213-i2c-mux-v5-2-fb2cbf9979b3@gmail.com/mbox/", "series": [ { "id": 492083, "url": "http://patchwork.ozlabs.org/api/series/492083/?format=api", "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=492083", "date": "2026-02-13T11:06:52", "name": "I2C Mux per channel bus speed", "version": 5, "mbox": "http://patchwork.ozlabs.org/series/492083/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2196303/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2196303/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "\n <linux-i2c+bounces-15973-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 (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20230601 header.b=i3pf9ATB;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=172.234.253.10; helo=sea.lore.kernel.org;\n envelope-from=linux-i2c+bounces-15973-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)", "smtp.subspace.kernel.org;\n\tdkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=\"i3pf9ATB\"", "smtp.subspace.kernel.org;\n arc=none smtp.client-ip=209.85.167.52", "smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=gmail.com" ], "Received": [ "from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])\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 4fC8jV6gF0z1xvQ\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 22:15:42 +1100 (AEDT)", "from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby sea.lore.kernel.org (Postfix) with ESMTP id E99413136F22\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 13 Feb 2026 11:08:07 +0000 (UTC)", "from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 62F68357A41;\n\tFri, 13 Feb 2026 11:08:00 +0000 (UTC)", "from mail-lf1-f52.google.com (mail-lf1-f52.google.com\n [209.85.167.52])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))\n\t(No client certificate requested)\n\tby smtp.subspace.kernel.org (Postfix) with ESMTPS id 7D8D72D7D59\n\tfor <linux-i2c@vger.kernel.org>; Fri, 13 Feb 2026 11:07:58 +0000 (UTC)", "by mail-lf1-f52.google.com with SMTP id\n 2adb3069b0e04-59e6c181402so1062285e87.3\n for <linux-i2c@vger.kernel.org>; Fri, 13 Feb 2026 03:07:58 -0800 (PST)", "from [192.168.1.135] (83-233-6-197.cust.bredband2.com.\n [83.233.6.197])\n by smtp.gmail.com with ESMTPSA id\n 38308e7fff4ca-387068924c3sm13635831fa.1.2026.02.13.03.07.55\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Fri, 13 Feb 2026 03:07:55 -0800 (PST)" ], "ARC-Seal": "i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1770980880; cv=none;\n b=JcdwiM1HBEnKu1zwV+Hwf1QNb4SkDEpl4KYqVAfSAELQxDKFrtBchq4La6l+NgIcsdyJw6XutEG8tNP4OCGZwrusMpX18aearcwKSBKADmY4fgO2SgifK2iA2xthlkKW3Za6kPOyhvp4YO9af1DKvf9NQUUVRpws24tRY58Br7A=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1770980880; c=relaxed/simple;\n\tbh=GAwGUaz+GqwpeQvnl1X7ahiwstVZRIvpf/1yMqLpIBk=;\n\th=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References:\n\t In-Reply-To:To:Cc;\n b=d8ObPbckrYwPKzvw+DQq5RAMt2U+CpuqtVCTxWro8PC71iykWIEh7Du5VIc8xpbdaTviW89Di8hJaOUv5ID2xtFIDUZvjhvEkGn77YHWPNpWUnTJNVZXvM11G2KTrqcM+R2HF0oI4m8YF+sIB4I35DWAPiU1v0l+vRmqSzKoFv4=", "ARC-Authentication-Results": "i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com;\n spf=pass smtp.mailfrom=gmail.com;\n dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com\n header.b=i3pf9ATB; arc=none smtp.client-ip=209.85.167.52", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20230601; t=1770980877; x=1771585677;\n darn=vger.kernel.org;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:from:to:cc:subject:date:message-id\n :reply-to;\n bh=zTB6xTbR9YUCnAVo0azw412iafjXj/Q1IfEGCYfMv3Q=;\n b=i3pf9ATBJI7DwnDhuySZL6KIAWJL9a0bSFHnLx3hmf5RgKkUx/mdXG+EUOYZMc5t7H\n zNSYyJA+CznyUTCJpQKPaycqnPXUUTtv9MGG3Mpod/HZCP7QshAGg9kkDg3gNMt71xEX\n woo12oVlW2F7gq5x7tGuIhU2/o0P7tsOLGTmpz2IoZ0aTdjb3SWifgphrdEhUZrKJBDk\n sh/pI1/XisVt8l6zDAZ90UEE7YWJkDgjyBhHOKLU4A3POfIR8y7ErpltuePOMAwYT9k4\n +pDjuwPylqdT1ArcGdt4m8aiP0M9QWaRvZQQTXHx9LaHPNaD6501xnJnhatJcVDWwEwI\n E86A==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20230601; t=1770980877; x=1771585677;\n h=cc:to:in-reply-to:references:message-id:content-transfer-encoding\n :mime-version:subject:date:from:x-gm-gg:x-gm-message-state:from:to\n :cc:subject:date:message-id:reply-to;\n bh=zTB6xTbR9YUCnAVo0azw412iafjXj/Q1IfEGCYfMv3Q=;\n b=gPJHaPSOpWtaD9WRkXD8ZWZ7ZcqZmjE11gC8jTv5OulMF+U9k3TyNX5EtzWpzSHoB/\n c3eGHLzGEpZwUABULOXEjY7aDHXgnAh4Fnwrd7f0QGkRS/mSI0Z8VCLPN0R+JbatJedc\n RSj/J4D1BNMIUoABAF/XiOM+MzHFh2cU4TSC46NETTL6xRuNOid64M8kdwE0u3StNJh7\n Oi+PMSXD2l8XVc0uu1rJ7tv1mHSxFGbfzlsyEK8nOKB1cWTGAaIQd3Oj7fDz2+So3vdo\n ETAmj8dsGHbNxZTc/ZpfPCACjvW/VaBCHYDcU3dwdLrArSmHDXXNtwowgsGn6erqOUbm\n otZg==", "X-Gm-Message-State": "AOJu0YzZI4nFUWq5xDBU6Vs6GyMOEWvaWNEkcC6yiwMbciozVy/N1456\n\tvJMXmuxHVCBA6oGFRSHbXTmd6OqsMiUiqZkwRaEyW6A+McQGCydjdFMf", "X-Gm-Gg": "AZuq6aK2E3gO2DiJ1mjwZAZKZC/dTxSsb4dHDLXyt8FwL4OHnrAMAbhZMTGTOvL5say\n\tOQDKYL0KcUjbkGqcRktvPvdsvWirxiiE2TWZd7D4m9zyH8obdwChiYUJKqglBZ+GCT2Y0c1RryH\n\tWAwikfz9mUuWQNNDAo2P5KBK4Na71Ceu8T2G9okzMZZoHBYV2DyEE7xs66TEp7C5/9dz3/81jrD\n\tqySXVVVA22jvcWhIidc/hqd6DY3ZNvo703AUhdLtZfPWx5MlIn5D/a0GDa8/YYrfap908hS5sI3\n\tabVtlYBF0a8ynoMxsDxmhN9oTi6svPcskDZzGPBwRNpgFC15wWoY7pTJf2KTJJVfEivhukawzH4\n\tpUbJIloJFg+QdIC7fAUF9s13U6GHdN4aqvGI1JkQNfVEcAgToBWYZ38IEoLpCuXokBs7JIwE6UZ\n\tV6Gje0h+dSFx7c4JxLX9imDwnEqk9qPpCPKhAIq6LNTNwhFRhfLYQ4IjgOwtyHdu74w/4QSHJyv\n\tbu/BnA=", "X-Received": "by 2002:a05:6512:2211:b0:59e:627f:7dac with SMTP id\n 2adb3069b0e04-59f69c26726mr549708e87.11.1770980876428;\n Fri, 13 Feb 2026 03:07:56 -0800 (PST)", "From": "Marcus Folkesson <marcus.folkesson@gmail.com>", "Date": "Fri, 13 Feb 2026 12:06:51 +0100", "Subject": "[PATCH v5 2/5] i2c: mux: add support for per channel bus frequency", "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-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260213-i2c-mux-v5-2-fb2cbf9979b3@gmail.com>", "References": "<20260213-i2c-mux-v5-0-fb2cbf9979b3@gmail.com>", "In-Reply-To": "<20260213-i2c-mux-v5-0-fb2cbf9979b3@gmail.com>", "To": "Wolfram Sang <wsa+renesas@sang-engineering.com>,\n Peter Rosin <peda@axentia.se>,\n Michael Hennerich <michael.hennerich@analog.com>,\n Bartosz Golaszewski <brgl@bgdev.pl>, Andi Shyti <andi.shyti@kernel.org>,\n Bartosz Golaszewski <brgl@kernel.org>", "Cc": "linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org,\n linux-arm-kernel@lists.infradead.org,\n Marcus Folkesson <marcus.folkesson@gmail.com>", "X-Mailer": "b4 0.14.3", "X-Developer-Signature": "v=1; a=openpgp-sha256; l=8549;\n i=marcus.folkesson@gmail.com; h=from:subject:message-id;\n bh=GAwGUaz+GqwpeQvnl1X7ahiwstVZRIvpf/1yMqLpIBk=;\n b=owEBbQKS/ZANAwAKAYiATm9ZXVIyAcsmYgBpjwYGuIK8exFqsvf3DBLtCgfwK6lnbHil0tXTZ\n Aas9o6VEqGJAjMEAAEKAB0WIQQFUaLotmy1TWTBLGWIgE5vWV1SMgUCaY8GBgAKCRCIgE5vWV1S\n Mg74EACm7dC1fqEhgRgE5JXfEyDwBbH77gywCuRIOdeyj9V9C82JIK4FmHsOKeSkiIbKk3es44d\n WG4C7U2KzJgAycihRJB5utVeK65J53nrnRvF4obR+Mae/LDkJRKnr/71hteNBx2og9T72plfmPp\n 1cTBBC/uK+vX2R27qaSZ6S1C6kHXvOQhANQTcuurY8trP2qangIPpFnsZXzrvyw0dGVEp5FUWcr\n rkEkJCrSeg4SdJzXFWIadFYpMehHfvCLYcB28OLFigOmMk2IKpH7+yWEoeoh49ss73/sBgEgJtj\n KprPDX/Gu9M+LeGbjs15MzsafBr/VwCrs+gAKPukbgV8sPlNU+GlaF13tHJmfJ2KKDhXQL5SDtu\n dW/SUpf9o4NMhBlI1U42CAP2BQuVeT2qjiqdAcqJiZ6KOjaHsOsEUH+8FzimBX5p392P14aAqY0\n t2VZHTBmna+RAYLKTlUG4hvl/AGasxT9roOCS4AUKrJm1vRAkiUHa9GDM+buy9KgxggwHvgG9b+\n fv7xDYjz2uTrPcpp6kpxScsF/ZFfMP0Xd0G93j1utlAJG7zBZQFT4gOXvaamwMxXZhlXpuajE7T\n Chefgjvqdvi6J4MtwXnYADgybTXPmDufSpmJoCnqrERkEXXtdo1wGE+4MiOeHvo455rOgfdz3/C\n 3rBSZQYm6fCuxkw==", "X-Developer-Key": "i=marcus.folkesson@gmail.com; a=openpgp;\n fpr=AB91D46C7E0F6E6FB2AB640EC0FE25D598F6C127" }, "content": "There may be several reasons why you may need to use a certain speed\non an I2C bus. E.g.\n\n- When several devices are attached to the bus, the speed must be\n selected according to the slowest device.\n\n- Electrical conditions may limit the usuable speed on the bus for\n different reasons.\n\nWith an I2C multiplexer, it is possible to group the attached devices\nafter their preferred speed by e.g. put all \"slow\" devices on a separate\nchannel on the multiplexer.\n\nConsider the following topology:\n\n .----------. 100kHz .--------.\n .--------. 400kHz | |--------| dev D1 |\n | root |--+-----| I2C MUX | '--------'\n '--------' | | |--. 400kHz .--------.\n | '----------' '-------| dev D2 |\n | .--------. '--------'\n '--| dev D3 |\n '--------'\n\nOne requirement with this design is that a multiplexer may only use the\nsame or lower bus speed as its parent.\nOtherwise, if the multiplexer would have to increase the bus frequency,\nthen all siblings (D3 in this case) would run into a clock speed it may\nnot support.\n\nThe bus frequency for each channel is set in the devicetree. As the\ni2c-mux bindings import the i2c-controller schema, the clock-frequency\nproperty is already allowed.\nIf no clock-frequency property is set, the channel inherit their parent\nbus speed.\n\nThe following example uses dt bindings to illustrate the topology above:\n\n i2c {\n\tclock-frequency = <400000>;\n\n i2c-mux {\n i2c@0 {\n clock-frequency = <100000>;\n\n D1 {\n ...\n };\n };\n\n i2c@1 {\n D2 {\n ...\n };\n };\n };\n\n D3 {\n ...\n }\n };\n\nSigned-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>\n---\n drivers/i2c/i2c-mux.c | 145 +++++++++++++++++++++++++++++++++++++++++++++-----\n 1 file changed, 133 insertions(+), 12 deletions(-)", "diff": "diff --git a/drivers/i2c/i2c-mux.c b/drivers/i2c/i2c-mux.c\nindex d59644e50f14..9116ee3fd979 100644\n--- a/drivers/i2c/i2c-mux.c\n+++ b/drivers/i2c/i2c-mux.c\n@@ -36,6 +36,100 @@ struct i2c_mux_priv {\n \tu32 chan_id;\n };\n \n+static struct i2c_mux_core *i2c_mux_topmost_mux_locked(struct i2c_adapter *adap)\n+{\n+\tstruct i2c_adapter *curr = adap;\n+\tstruct i2c_adapter *parent;\n+\tstruct i2c_mux_core *result = NULL;\n+\n+\tdo {\n+\t\tparent = i2c_parent_is_i2c_adapter(curr);\n+\t\tif (parent) {\n+\t\t\tstruct i2c_mux_priv *priv = curr->algo_data;\n+\n+\t\t\tif (priv && priv->muxc && priv->muxc->mux_locked)\n+\t\t\t\tresult = priv->muxc;\n+\t\t}\n+\t\tcurr = parent;\n+\t} while (parent);\n+\n+\treturn result;\n+}\n+\n+static int i2c_mux_select_chan(struct i2c_adapter *adap, u32 chan_id)\n+{\n+\tstruct i2c_mux_priv *priv = adap->algo_data;\n+\tstruct i2c_mux_core *muxc = priv->muxc;\n+\tstruct i2c_adapter *parent = muxc->parent;\n+\tstruct i2c_mux_core *mux_locked_ancestor = NULL;\n+\tstruct i2c_adapter *root;\n+\tint ret;\n+\n+\tif (priv->adap.clock_hz && priv->adap.clock_hz != parent->clock_hz) {\n+\t\tmux_locked_ancestor = i2c_mux_topmost_mux_locked(adap);\n+\t\troot = i2c_root_adapter(&adap->dev);\n+\n+\t\t/*\n+\t\t * If there's a mux-locked mux in our ancestry, lock the parent\n+\t\t * of the topmost one. Mux-locked muxes don't propagate locking\n+\t\t * to their parents, so we must explicitly acquire the lock above\n+\t\t * the highest mux-locked ancestor to reach the root adapter.\n+\t\t */\n+\t\tif (mux_locked_ancestor)\n+\t\t\ti2c_lock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER);\n+\n+\t\tret = i2c_adapter_set_clk_freq(root, priv->adap.clock_hz);\n+\n+\t\tif (mux_locked_ancestor)\n+\t\t\ti2c_unlock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER);\n+\n+\t\tif (ret < 0) {\n+\t\t\tdev_err(&adap->dev,\n+\t\t\t\t\"Failed to set clock frequency %dHz on root adapter %s: %d\\n\",\n+\t\t\t\tpriv->adap.clock_hz, root->name, ret);\n+\n+\t\t\treturn ret;\n+\t\t}\n+\t}\n+\n+\treturn muxc->select(muxc, priv->chan_id);\n+}\n+\n+static void i2c_mux_deselect_chan(struct i2c_adapter *adap, u32 chan_id)\n+{\n+\tstruct i2c_mux_priv *priv = adap->algo_data;\n+\tstruct i2c_mux_core *muxc = priv->muxc;\n+\tstruct i2c_adapter *parent = muxc->parent;\n+\tstruct i2c_mux_core *mux_locked_ancestor = NULL;\n+\tstruct i2c_adapter *root;\n+\tint ret;\n+\n+\tif (parent->clock_hz && parent->clock_hz != priv->adap.clock_hz) {\n+\t\tmux_locked_ancestor = i2c_mux_topmost_mux_locked(adap);\n+\t\troot = i2c_root_adapter(&parent->dev);\n+\n+\t\t/*\n+\t\t * If there's a mux-locked mux in our ancestry, lock the parent\n+\t\t * of the topmost one. Mux-locked muxes don't propagate locking\n+\t\t * to their parents, so we must explicitly acquire the lock above\n+\t\t * the highest mux-locked ancestor to reach the root adapter.\n+\t\t */\n+\t\tif (mux_locked_ancestor)\n+\t\t\ti2c_lock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER);\n+\n+\t\tret = i2c_adapter_set_clk_freq(root, parent->clock_hz);\n+\n+\t\tif (mux_locked_ancestor)\n+\t\t\ti2c_unlock_bus(mux_locked_ancestor->parent, I2C_LOCK_ROOT_ADAPTER);\n+\n+\t\tif (ret < 0)\n+\t\t\treturn;\n+\t}\n+\n+\tif (muxc->deselect)\n+\t\tmuxc->deselect(muxc, priv->chan_id);\n+}\n+\n static int __i2c_mux_master_xfer(struct i2c_adapter *adap,\n \t\t\t\t struct i2c_msg msgs[], int num)\n {\n@@ -46,11 +140,11 @@ static int __i2c_mux_master_xfer(struct i2c_adapter *adap,\n \n \t/* Switch to the right mux port and perform the transfer. */\n \n-\tret = muxc->select(muxc, priv->chan_id);\n+\tret = i2c_mux_select_chan(adap, priv->chan_id);\n \tif (ret >= 0)\n \t\tret = __i2c_transfer(parent, msgs, num);\n-\tif (muxc->deselect)\n-\t\tmuxc->deselect(muxc, priv->chan_id);\n+\n+\ti2c_mux_deselect_chan(adap, priv->chan_id);\n \n \treturn ret;\n }\n@@ -65,11 +159,11 @@ static int i2c_mux_master_xfer(struct i2c_adapter *adap,\n \n \t/* Switch to the right mux port and perform the transfer. */\n \n-\tret = muxc->select(muxc, priv->chan_id);\n+\tret = i2c_mux_select_chan(adap, priv->chan_id);\n \tif (ret >= 0)\n \t\tret = i2c_transfer(parent, msgs, num);\n-\tif (muxc->deselect)\n-\t\tmuxc->deselect(muxc, priv->chan_id);\n+\n+\ti2c_mux_deselect_chan(adap, priv->chan_id);\n \n \treturn ret;\n }\n@@ -86,12 +180,12 @@ static int __i2c_mux_smbus_xfer(struct i2c_adapter *adap,\n \n \t/* Select the right mux port and perform the transfer. */\n \n-\tret = muxc->select(muxc, priv->chan_id);\n+\tret = i2c_mux_select_chan(adap, priv->chan_id);\n \tif (ret >= 0)\n \t\tret = __i2c_smbus_xfer(parent, addr, flags,\n \t\t\t\t read_write, command, size, data);\n-\tif (muxc->deselect)\n-\t\tmuxc->deselect(muxc, priv->chan_id);\n+\n+\ti2c_mux_deselect_chan(adap, priv->chan_id);\n \n \treturn ret;\n }\n@@ -108,12 +202,12 @@ static int i2c_mux_smbus_xfer(struct i2c_adapter *adap,\n \n \t/* Select the right mux port and perform the transfer. */\n \n-\tret = muxc->select(muxc, priv->chan_id);\n+\tret = i2c_mux_select_chan(adap, priv->chan_id);\n \tif (ret >= 0)\n \t\tret = i2c_smbus_xfer(parent, addr, flags,\n \t\t\t\t read_write, command, size, data);\n-\tif (muxc->deselect)\n-\t\tmuxc->deselect(muxc, priv->chan_id);\n+\n+\ti2c_mux_deselect_chan(adap, priv->chan_id);\n \n \treturn ret;\n }\n@@ -223,6 +317,7 @@ struct i2c_adapter *i2c_root_adapter(struct device *dev)\n }\n EXPORT_SYMBOL_GPL(i2c_root_adapter);\n \n+\n struct i2c_mux_core *i2c_mux_alloc(struct i2c_adapter *parent,\n \t\t\t\t struct device *dev, int max_adapters,\n \t\t\t\t int sizeof_priv, u32 flags,\n@@ -362,6 +457,32 @@ int i2c_mux_add_adapter(struct i2c_mux_core *muxc,\n \t\t\t}\n \t\t}\n \n+\t\tof_property_read_u32(child, \"clock-frequency\", &priv->adap.clock_hz);\n+\n+\t\t/* If the mux adapter has no clock-frequency property, inherit from parent */\n+\t\tif (!priv->adap.clock_hz)\n+\t\t\tpriv->adap.clock_hz = parent->clock_hz;\n+\n+\t\t/*\n+\t\t * Warn if the mux adapter is not parent-locked as\n+\t\t * this may cause issues for some hardware topologies.\n+\t\t */\n+\t\tif ((priv->adap.clock_hz < parent->clock_hz) && muxc->mux_locked)\n+\t\t\tdev_warn(muxc->dev,\n+\t\t\t\t \"channel %u is slower than parent on a non parent-locked mux\\n\",\n+\t\t\t\t chan_id);\n+\n+\t\t/* We don't support mux adapters faster than their parent */\n+\t\tif (priv->adap.clock_hz > parent->clock_hz) {\n+\t\t\tdev_err(muxc->dev,\n+\t\t\t\t\"channel (%u) is faster (%u) than parent (%u)\\n\",\n+\t\t\t\tchan_id, priv->adap.clock_hz, parent->clock_hz);\n+\n+\t\t\tof_node_put(mux_node);\n+\t\t\tret = -EINVAL;\n+\t\t\tgoto err_free_priv;\n+\t\t}\n+\n \t\tpriv->adap.dev.of_node = child;\n \t\tof_node_put(mux_node);\n \t}\n", "prefixes": [ "v5", "2/5" ] }