From patchwork Sat Nov 13 15:23:14 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12617707 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CA452C433EF for ; Sat, 13 Nov 2021 15:23:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A577E610A0 for ; Sat, 13 Nov 2021 15:23:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231791AbhKMP0d (ORCPT ); Sat, 13 Nov 2021 10:26:33 -0500 Received: from mail.kernel.org ([198.145.29.99]:43410 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235945AbhKMP0c (ORCPT ); Sat, 13 Nov 2021 10:26:32 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id A6EA361106; Sat, 13 Nov 2021 15:23:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636817020; bh=Fn/AD43R2TfbnwgaRvVaMIcV4fPfI5kVh55I88u1Ge8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tCL2hHiF17AB1aHrAKyP3A4uDtzgaoKSDJe3n/jjX6o5rLrrTZdyGi2RvUAKSxear ylGHFKBKKjLuXsTJAv7F51fV8u6sA7gO4PlLOcj3u+nCe1JztDKJysbEDYELuZJxBV NMJvMILeQgtFmAfDdljsaBKPtQ3V0WqgDi30GMRlJs7YhVzcf9uDe9vGnEfGLFN1iD CSeldxtdLkxsa/iAAnztxR8FXI5XVDz4TBDVV405j4w65j4+cLv/za6jPYAcRii1bo HomPVrO85HbEpW0LZQMmwG3C1o6R/GKwQMvHizTKbjdgxMXQ2lWL4cCEYJHMnm1Dpq tsbnujtVTTCKg== From: Lorenzo Bianconi To: jic23@kernel.org Cc: lorenzo.bianconi@redhat.com, linux-iio@vger.kernel.org, mario.tesi@st.com, devicetree@vger.kernel.org Subject: [PATCH v2 1/2] iio: imu: st_lsm6dsx: add dts property to disable sensor-hub Date: Sat, 13 Nov 2021 16:23:14 +0100 Message-Id: X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Introduce the capability to disable sensorhub through a device-tree property since there are some configurations where users want to explicitly disable sensor-hub auto-probing at bootstrap. A typical configuration is when the sensorhub clock/data lines are connected to a pull-up resistor since no slave sensors are connected to the i2c master. If SDO/SA0 line is connected to the same pull-up resistor, when the driver tries to probe slave devices connected on sensor-hub, it will force SDO/SA0 line to low, modifying the device i2c address. Tested-by: Mario Tesi Signed-off-by: Lorenzo Bianconi --- drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c index f2cbbc756459..727b4b6ac696 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_core.c @@ -2244,7 +2244,9 @@ int st_lsm6dsx_probe(struct device *dev, int irq, int hw_id, return err; hub_settings = &hw->settings->shub_settings; - if (hub_settings->master_en.addr) { + if (hub_settings->master_en.addr && + (!dev_fwnode(dev) || + !device_property_read_bool(dev, "st,disable-sensor-hub"))) { err = st_lsm6dsx_shub_probe(hw, name); if (err < 0) return err; From patchwork Sat Nov 13 15:23:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 12617709 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BF0EFC433EF for ; Sat, 13 Nov 2021 15:23:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A57ED610A0 for ; Sat, 13 Nov 2021 15:23:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235961AbhKMP0g (ORCPT ); Sat, 13 Nov 2021 10:26:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:43440 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235945AbhKMP0f (ORCPT ); Sat, 13 Nov 2021 10:26:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0134A61152; Sat, 13 Nov 2021 15:23:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636817023; bh=Zr/+TRuhBCTVlFPXo508fLB62lAwfVC+qlp87/vU5rg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JrdPUxQzsH7t2gEfw161Y68XKqD1cHUsf3FcC7E09ynko9UmnK7qr+yj1W8gt7kHq lJOOfhlCizJsJgn1WE86WeLMEWUQyiSX4vVVgLhohXUJXStCtnMWs0yAem2t476+Er j6X2WWIROn9JGEFKUURShLnxBrtcw4FF4qsTkIpD1CfkMsOmO/8TNc1a+241Qzgr+W Mc3MGFzL370hYQIH8lR3ewm06y1PtQoheMpswMq1Jn3Bu2OOZvfb9pX0efciP+CU9z EozV0091jAYvSE+NRhPHm2z2iYMKGhqQDRaVer1UK5pN77LMSjP/rYLy9fntXNaE+K m6trbeJ0apBqA== From: Lorenzo Bianconi To: jic23@kernel.org Cc: lorenzo.bianconi@redhat.com, linux-iio@vger.kernel.org, mario.tesi@st.com, devicetree@vger.kernel.org Subject: [PATCH v2 2/2] Documentation: dt: iio: st_lsm6dsx: add disable-sensor-hub property Date: Sat, 13 Nov 2021 16:23:15 +0100 Message-Id: <54287a93922ac839501b776d288cc368aa81f0ab.1636816719.git.lorenzo@kernel.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org Enable/disable internal i2c controller slave autoprobing at bootstrap. Disable sensor-hub is useful if i2c controller clock/data lines are connected through a pull-up with other chip lines (e.g. SDO/SA0). Signed-off-by: Lorenzo Bianconi Reviewed-by: Rob Herring --- Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml index d9b3213318fb..0750f700a143 100644 --- a/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml +++ b/Documentation/devicetree/bindings/iio/imu/st,lsm6dsx.yaml @@ -61,6 +61,13 @@ properties: type: boolean description: enable/disable internal i2c controller pullup resistors. + st,disable-sensor-hub: + type: boolean + description: + Enable/disable internal i2c controller slave autoprobing at bootstrap. + Disable sensor-hub is useful if i2c controller clock/data lines are + connected through a pull-up with other chip lines (e.g. SDO/SA0). + drive-open-drain: type: boolean description: