Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2113701imm; Sat, 29 Sep 2018 10:39:32 -0700 (PDT) X-Google-Smtp-Source: ACcGV60/BPuTa6wKSYZjq+jBYP/+O54iLj2RfhQ1gUZuj9q79aGq2o7ILh7/q3hPF+kyObcXiPR1 X-Received: by 2002:a65:5bc1:: with SMTP id o1-v6mr3670123pgr.391.1538242772895; Sat, 29 Sep 2018 10:39:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538242772; cv=none; d=google.com; s=arc-20160816; b=w+RyPwzKiH7BvNgyxeoYe2waLJUKp9BDatSBlv0L7egr2SU7HUJELqoK8hb9fHrids JaBqjBL/mVu9KgwxjgTVORrjTXDGPK/tQdmkYGS6DbPWYX06t/V/9FUpUUz2qeKhcSib TB89iNsZlHk6qLjm2TQZ/ZCXW2D3a0WRP4RsJsKouDAGCNvVSkUFO6K/Ce3GiWa+g1HD f6p9GtTsOWnEBt6SbikdL1EdKV/yQMqm8+k4C1d7iB2LBEagoVYBTSwprZT6nQkrzoh8 cVkV7B+NljhBVfn3SczG5W7oIbVQmlYo0fixh5l9xn2O/7gAcBf/3tDFq/zDHIUPHvyv 8pZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=uhP9pGm2YvWCOK1DcegOUvHeqpp3ueIbWs8jl+gdSSQ=; b=MQjw8BCZMHJVUh4RwDjzzAG8IT287TIBqtSQBju6Y39a3H4paGf4hKkyWiTYC/PJtT b9EAYxcdPjZksS9XZt6jMzfJpr98KHzu4+8VN3nJqQzplSSmwxxJCpr+BVwyanW/Jdd5 5GuflQn4XXQVRzKNvMDY0aTJ010e4tyR24HdHDddrC39//kdp4Keo8aEjo+ioti+nBN7 nGHmKfzyDWSSltSaZnJzJQvvl9RQYrmrdMOEpNWOeon17Oew3cseIeYpiWN8wiMdPuWR 4Tvz8Dn+mo9tfp+rXefFL+hQg3Uo6WwiBPPvBazAVRsQ5vHpSTV0v+65krpKhDdyuYlo lNkQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gViMtbc7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z138-v6si8668437pfc.181.2018.09.29.10.39.18; Sat, 29 Sep 2018 10:39:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gViMtbc7; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728534AbeI3AHl (ORCPT + 99 others); Sat, 29 Sep 2018 20:07:41 -0400 Received: from mail-it1-f193.google.com ([209.85.166.193]:37046 "EHLO mail-it1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728364AbeI3AHl (ORCPT ); Sat, 29 Sep 2018 20:07:41 -0400 Received: by mail-it1-f193.google.com with SMTP id m9-v6so6566377ita.2 for ; Sat, 29 Sep 2018 10:38:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uhP9pGm2YvWCOK1DcegOUvHeqpp3ueIbWs8jl+gdSSQ=; b=gViMtbc7XpI5Zami65vsFjFs5r9Ss/3p0CP6dAWnDsQPe711UkZNw3dlQcE/Nvv+Gt TmfRcP+9BjZdrBRA/cCrmsL/Qnd7i6LxWZqTml7A8GCaq2ahiew1PLBybWGm/P4E2eHR UAyL2vGoZxAGWa+O+YqH1d0UdVpYFLhdEtqqI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uhP9pGm2YvWCOK1DcegOUvHeqpp3ueIbWs8jl+gdSSQ=; b=Z72htMONJ/N5CDDJzoLnoVw9YsFdswAidpLy0RP23bGSQEOpEcrUvjMMIP9zhVW/Yg TyQNaJArK7WRt30u+5XQFrOyJycFvcC3W7lPuezLiKIMhBeCSb5jnqO8OGST8pCQE9OI toRpd2su+qtcWjQe+w8pvtvjpPDZMqJNXetTZui0xHuPrVDMNJWPlxPfB/Cg4tu/jHdg wP+ycuWf0ATQcYDdgoqnl2fpXcamGhFFgrxbO7DpIPGfXhx+XUgijBxMc5QpR1/7kiAk Sb2p0YQFDnLwQpyrscLlwVt4MQEEfrMlLLMEnPAb66iRJtOaZiAqCDLHdVZk7p+EE5BN FKRg== X-Gm-Message-State: ABuFfojLgQ1Sp3LA1JgyLMpp8NONSsZe9eZGMuAYEJhAOmOVZofax9XI tlwu22Bvm4causPyXBy2yABYM2n/uC2y8XC4QUetPA== X-Received: by 2002:a24:83c1:: with SMTP id d184-v6mr5718221ite.16.1538242705185; Sat, 29 Sep 2018 10:38:25 -0700 (PDT) MIME-Version: 1.0 References: <20180906122436.25610-1-linus.walleij@linaro.org> In-Reply-To: From: Linus Walleij Date: Sat, 29 Sep 2018 19:38:12 +0200 Message-ID: Subject: Re: [PATCH v7] regulator: fixed: Convert to use GPIO descriptor only To: John Stultz Cc: Anders Roxell , Liam Girdwood , Mark Brown , "linux-kernel@vger.kernel.org" , Janusz Krzysztofik , Alexander Shiyan , Haojian Zhuang , Aaro Koskinen , Mike Rapoport , Robert Jarzmik , Philipp Zabel , Daniel Mack , Marc Zyngier , jacopo , Geert Uytterhoeven , Russell King , Tom Gall Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Sep 29, 2018 at 1:32 AM John Stultz wrote: > Anders recently noted a regression in -next when running HiKey, > where USB fails to function. I took a look and could reproduce this > as well, and after some unsuccessful muddling about in the usb > changes, I bisected it down to your commit here (specifically > efdfeb079cc3 in -next). > > I'm not sure exactly why this would cause trouble, but I suspect it > has something to do w/ the cable-detect OTG to host-hub switch on the > HiKey. > > Anyway, I just wanted to raise this with you so it can get sorted out > before that patch hits mainline. OK how typical, let's see if we can figure it out. I looked at it but I can't see what it is right off. I guess it is this from arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts: reg_5v_hub: regulator@2 { compatible = "regulator-fixed"; regulator-name = "5V_HUB"; regulator-min-microvolt = <5000000>; regulator-max-microvolt = <5000000>; regulator-boot-on; gpio = <&gpio0 7 0>; regulator-always-on; vin-supply = <®_sys_5v>; }; It's a regulator with one GPIO. It used to be fetched here: + cfg.ena_gpiod = devm_gpiod_get_optional(&pdev->dev, NULL, gflags); + if (IS_ERR(cfg.ena_gpiod)) + return PTR_ERR(cfg.ena_gpiod); So first would be to put in a print like this: if (IS_ERR(cfg.ena_gpiod)) { dev_info(&pdev->dev, "error fetching enable GPIO for %s, %d\n", dev_name(&pdev->dev), PTR_ERR(cfg.ena_gpiod)); return PTR_ERR(cfg.ena_gpiod); } if (!cfg.ena_gpiod) dev_info(&pdev->dev, "no enable GPIO for %s\n", dev_name(&pdev->dev)); else dev_info(&pdev->dev, "fetched valid enable GPIO for %s\n", dev_name(&pdev->dev)); So we make sure we get the enable GPIO handle. Else we need to troubleshoot that. Look if -ENOENT or -EPROBE_DEFER gets returned for example. If those works we need to check the flags. Since this GPIO is specified with gpio = <&gpio0 7 0>; it would nominally mean it is active high. But there is special code in drivers/gpio/gpiolib-of.c to deal with regulators, since those lines are by default active low and ignore the flags in the second cell from the device tree. In of_gpio_flags_quirks(), we force the GPIO to be active low unless "enable-active-high" is set. So we need to look in /sys/kernel/debug/gpio or just lsgpio to see if the active edge is the same before/after the patch. Sadly I don't have this board myself! Yours, Linus Walleij