Message ID | 20230729160857.6332-1-clamor95@gmail.com |
---|---|
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:918b:0:b0:3e4:2afc:c1 with SMTP id s11csp1161674vqg; Sat, 29 Jul 2023 11:25:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlHNW/8d+/e5gvWvNvVwYN3pO68YerwyQFYCAu5ppKpsAzccbiXfZpx8Kfl7dJuwHoDBZPcY X-Received: by 2002:a17:906:10dc:b0:99b:f645:224 with SMTP id v28-20020a17090610dc00b0099bf6450224mr2622184ejv.9.1690655158426; Sat, 29 Jul 2023 11:25:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690655158; cv=none; d=google.com; s=arc-20160816; b=PpqvVqe62CQebpiQETngvYIIGi7sXjTmrWUjY5chMFq3r64PE3Qf0qTC6hDIqB9JH3 pC8oHLvCAO0svmzxXDbLRnRpsTiN5OxD58QYOfZuoyW+/pl2FG1yfU7hXj2Qp5aJSbSc wIUnLEY/vPL1dgGWzAYfOl671DWc/4XPH3dWFnDmkCLjPbONDPpEIpW77R3okkGVFh7z NBDqSBtqsPnRtJeF04d4DNI7HCAfGFyoneRVNWBvg9mgkz2FKAvHjacThGLMv+WIs2tv V5kfw93rE6Ww7f+44ECPHYS+k2B1QLKQJA3gY1x1+vf+kjUffz5qsKFSh+SG/sU/zGBI p7xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=kYuOI65YzPrj3n+lLQ6cTdOtLO/GiTyHb3SVK41xJL0=; fh=bzppE1/iAplbw1xybVAfgEEAUsBu29MZ3J9baXku07w=; b=qCF0ZBrvEuKC3W4kfWpxcgCmP+EkYqLDd1cYCVFU8TyKYWGvHWueLp8N+sfTQ0pAZx Yt8rvKErbW4RfEy5FFHnr2+glLTZjtsGaU/NNLcqitJzu6Ezl2lUs4Cj0c4PXtWKmCU0 RNxEv+uQsClATtsOQH1Af/ZaXDcCQb9SQHfee6ULG7kWgwfic/OOUaut+P10O9vnM5ag jeF0QUGLg4xuF0B/6CXjx0OGIlPubBvO2aEu7VB9RAUJu2n4o2ll11P2fq4Sa8/9YnAB h1fw2PIf29wkTid/FUEQ7nxjsBXLXqpCudWw+rnnDzw3UbRrOxamgPGdPpyCe8A0OokM 0Mug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=T4NbtfL5; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o22-20020aa7c516000000b005227f01d522si4537838edq.666.2023.07.29.11.25.34; Sat, 29 Jul 2023 11:25:58 -0700 (PDT) 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=@gmail.com header.s=20221208 header.b=T4NbtfL5; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229573AbjG2QJ3 (ORCPT <rfc822;hanasaki@gmail.com> + 99 others); Sat, 29 Jul 2023 12:09:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229379AbjG2QJ1 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 29 Jul 2023 12:09:27 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81F6EA8; Sat, 29 Jul 2023 09:09:26 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id 38308e7fff4ca-2b9dc1bff38so6975011fa.1; Sat, 29 Jul 2023 09:09:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690646965; x=1691251765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=kYuOI65YzPrj3n+lLQ6cTdOtLO/GiTyHb3SVK41xJL0=; b=T4NbtfL5FaqYm+mdCgKbufrc7EjCOxUovoV+JIx4PGuceIV38teYQyza+3ly+p+h7C rvPSqPc91EVn7T2N9Y8zft15HndkjRj4HDiqS+J5QDjlk+oPR/8Z7+qtDyKB4lsJYXNB exZD7P3iwAkglYsrN4hzBV5839nmu+5X18WzzXykh9JLsPmrrxSICcsd632u5M+l8YLX cSjYztcHeR8NGAqq+cIJB5ERQns+mNFHe9yUAnn1wsN0K4EWpnG9G7mmi6SpeOJw9iGE JUPG29huPwAglcGc+u8PI7OTKI3pQQNjJhGYSrL1a7zRJnsk6c+zLEb8rADuXju/Srs7 /Mzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690646965; x=1691251765; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kYuOI65YzPrj3n+lLQ6cTdOtLO/GiTyHb3SVK41xJL0=; b=Y03d6Hv8exjTWfdDPS2YJI66hvuEYr2U2+Ajt+QCafN97AQMRDiJleOpIiPTZAaXx3 ufTtLmptrP/H8LQn/+/gx2gjUPar8LDhNj0E/jCU0mePGyZ4Rg4Rf9VHUuG6+D4jysYX oYQNoEAxsDwJOlTsNxLClUDoxFZKFRxNkbudpQ9KBqoUpdgrfrlqOCLHs28oFmJfcrQT ON1LiHujzVrRBDleo3j6j466pa6NKCyzhvIgzemUWibiUd30rNenRDK+MugE1i2dFlL/ YJnFAe2HazAIaJouyzBUL7Esg/SKlPtkODBE5VMrc7MetGoSGzfB6SouDqIXj6r6edoq qYTg== X-Gm-Message-State: ABy/qLbbXM3DgdoVmsA7jtT3/mPQ9vYYWYd8it+LL6J8fGrLzEWGCrkN jG2vnd7irCiZtoIwm12XHDG+HvhZ5PebUg== X-Received: by 2002:a2e:9150:0:b0:2b9:b27c:f727 with SMTP id q16-20020a2e9150000000b002b9b27cf727mr4056532ljg.8.1690646964408; Sat, 29 Jul 2023 09:09:24 -0700 (PDT) Received: from xeon.. ([188.163.112.48]) by smtp.gmail.com with ESMTPSA id f10-20020a2ea0ca000000b002b6daa3fa2csm1346886ljm.69.2023.07.29.09.09.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jul 2023 09:09:24 -0700 (PDT) From: Svyatoslav Ryhel <clamor95@gmail.com> To: Andi Shyti <andi.shyti@kernel.org>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Wolfram Sang <wsa@kernel.org>, =?utf-8?b?TWljaGHFgiBNaXJvc8WCYXc=?= <mirq-linux@rere.qmqm.pl>, Svyatoslav Ryhel <clamor95@gmail.com> Cc: linux-i2c@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 0/2] GPIO-based hotplug i2c bus Date: Sat, 29 Jul 2023 19:08:55 +0300 Message-Id: <20230729160857.6332-1-clamor95@gmail.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1772780423772091519 X-GMAIL-MSGID: 1772780423772091519 |
Series |
GPIO-based hotplug i2c bus
|
|
Message
Svyatoslav Ryhel
July 29, 2023, 4:08 p.m. UTC
ASUS Transformers require this driver for proper work with their dock. Dock is controlled by EC and its presence is detected by a GPIO. The Transformers have a connector that's used for USB, charging or for attaching a keyboard (called a dock; it also has a battery and a touchpad). This connector probably (I don't have the means to verify that) has an I2C bus lines and a "detect" line (pulled low on the dock side) among the pins. I guess there is either no additional chip or a transparent bridge/buffer chip, but nothing that could be controlled by software. For DT this setup could be modelled like an I2C gate or a 2-port mux with enable joining two I2C buses (one "closer" to the CPU as a parent). In this case it's hard to tell the difference if this is real or virtual hardware. This patchset is a predecessor of a possible larger patchset which should bring support for a asus-ec, an i2c mfd device programmed by Asus for their Transformers tablet line. Similar approach is used in Microsoft Surface RT for attachable Type Cover. > What is this actually doing? Basically it duplicates the parent i2c bus once detection GPIO triggers and probes all hot-pluggable devices which are connected to it. Once GPIO triggers a detach signal all hot-pluggable devices are unprobed and bus removed. > Is the GPIO an irq line for signalling hoplugging and can be used by > any driver or just this one? It can be shared if necessary but usually all hot-pluggable devices are gathered in one container and are plugged simultaneously. --- Changes from v2: - expanded descryption of driver implementation commit - expanded descryption in patchset cover - no changes to code or yaml from v2 Changes from v1: - documentation changes: - dropped | from description - dropped nodename - unified use of quotes - used GPIO_ACTIVE_LOW define - used phandle instead of path --- Michał Mirosław (1): i2c: Add GPIO-based hotplug gate Svyatoslav Ryhel (1): dt-bindings: i2c: add binding for i2c-hotplug-gpio .../bindings/i2c/i2c-hotplug-gpio.yaml | 65 +++++ drivers/i2c/Kconfig | 11 + drivers/i2c/Makefile | 1 + drivers/i2c/i2c-hotplug-gpio.c | 266 ++++++++++++++++++ 4 files changed, 343 insertions(+) create mode 100644 Documentation/devicetree/bindings/i2c/i2c-hotplug-gpio.yaml create mode 100644 drivers/i2c/i2c-hotplug-gpio.c
Comments
Hi Svyatoslav, On Sat, Jul 29, 2023 at 07:08:55PM +0300, Svyatoslav Ryhel wrote: > ASUS Transformers require this driver for proper work with their dock. > Dock is controlled by EC and its presence is detected by a GPIO. > > The Transformers have a connector that's used for USB, charging or > for attaching a keyboard (called a dock; it also has a battery and > a touchpad). This connector probably (I don't have the means to verify > that) has an I2C bus lines and a "detect" line (pulled low on the dock > side) among the pins. I guess there is either no additional chip or > a transparent bridge/buffer chip, but nothing that could be controlled > by software. For DT this setup could be modelled like an I2C gate or > a 2-port mux with enable joining two I2C buses (one "closer" to the > CPU as a parent). > > In this case it's hard to tell the difference if this is real or virtual > hardware. How did you test this device? > This patchset is a predecessor of a possible larger patchset which > should bring support for a asus-ec, an i2c mfd device programmed by > Asus for their Transformers tablet line. Similar approach is used in > Microsoft Surface RT for attachable Type Cover. Would be nice to have a driver using this support in the series, otherwise it looks like thrown there without any use. Do you have any use of it already? Even in your private repository just to take a look. Thanks, Andi
нд, 30 лип. 2023 р. о 20:49 Andi Shyti <andi.shyti@kernel.org> пише: > > Hi Svyatoslav, > > On Sat, Jul 29, 2023 at 07:08:55PM +0300, Svyatoslav Ryhel wrote: > > ASUS Transformers require this driver for proper work with their dock. > > Dock is controlled by EC and its presence is detected by a GPIO. > > > > The Transformers have a connector that's used for USB, charging or > > for attaching a keyboard (called a dock; it also has a battery and > > a touchpad). This connector probably (I don't have the means to verify > > that) has an I2C bus lines and a "detect" line (pulled low on the dock > > side) among the pins. I guess there is either no additional chip or > > a transparent bridge/buffer chip, but nothing that could be controlled > > by software. For DT this setup could be modelled like an I2C gate or > > a 2-port mux with enable joining two I2C buses (one "closer" to the > > CPU as a parent). > > > > In this case it's hard to tell the difference if this is real or virtual > > hardware. > > How did you test this device? > Using devices, which relay on this patch, here is a list of those: - ASUS Eee Pad Transformer TF101 (mainlined) - ASUS Transformer Prime TF201 (mainlined) - ASUS Transformer Pad TF300T/TF300TG/TF300TL (mainlined) - ASUS Transformer Infinity TF700T (mainlined) - ASUS VivoTab RT TF600T (WIP) - ASUS Transformer Pad TF701T (mainlined) Non ASUS device is Microsoft Surface RT Tested by many owners and users for more than a year iirc. > > This patchset is a predecessor of a possible larger patchset which > > should bring support for a asus-ec, an i2c mfd device programmed by > > Asus for their Transformers tablet line. Similar approach is used in > > Microsoft Surface RT for attachable Type Cover. > > Would be nice to have a driver using this support in the series, > otherwise it looks like thrown there without any use. Do you have > any use of it already? Even in your private repository just to > take a look. > Bindings which call gpio hotplug i2c bus: ASUS TF https://github.com/clamor-s/linux/commit/360f62f706670ab13101ef15b7f2bc8880da7a48 ASUS TF600T/TF701T https://github.com/clamor-s/linux/blob/transformer/arch/arm/boot/dts/tegra30-asus-tf600t.dts#L1050-L1089 Surface RT https://github.com/grate-driver/linux/blob/master/arch/arm/boot/dts/tegra30-microsoft-surface-rt.dts#L35-L53 > Thanks, > Andi