Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3038405pxk; Mon, 7 Sep 2020 00:58:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy953udpraNF8H9XBjgKDbPdOCjnN9HI9nZk2qVNSNi0jYbwo8uHqOX5uUeMyztltDiasUx X-Received: by 2002:a17:907:7206:: with SMTP id dr6mr20667404ejc.546.1599465536015; Mon, 07 Sep 2020 00:58:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599465536; cv=none; d=google.com; s=arc-20160816; b=IgZpHHTBBV0ErXtbBocKDjwgrOLu/WugEgSI2clrshQnAHa11kSdw6muBvZTzMV/pQ ZFWULwaRlpzdVeNUQvdhas47Ewqh/3qq1Idzc5ccesEdQPjHbFAvqxwM/kUk4ncPOmUA qyJLZS2ALG7NcY+ivG6RlAkoyRwwRYirDAXSOCPk0uTLEdg12hT2kNntNR2TLFMt9Tz0 +EP3iwR2Jx6XshHjUSxyc8KhV73RJBCxAepv5egMPd2Zd3wkGmwmV85TdREZ7ocCsdTh aSUq50vzVb81PRXHPFqYd9AF36zgK+uYa/fGk39K5t614QNsWdVLVPXVBTrO6VVNizXH 5CEg== 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; bh=uuBwypJmHWQd5+fhA+Qi5ygJwZd3WxmHZlgvS26xGCM=; b=Ftj3qJ7OwxQIsb/B1X43T5pOwR6Oh0lmSeSRHO90niSqOXM3yELkmSS1QokCt/xu9H pvTN7l9hy2K/IV06rNJX71nlZgsVW72Us8X/yYs6b1/8wNJvcJ8WhA0WLadeY9osfqUx /vVrwM0qrTa+1L1Qg6wQ9geL7invlDtO8y4OPhOnRYdbLQauLAVTj921Pdlm2H4Fpq8m cct3vYxHpZyTZL7eXrfE38r7Zytrdx/mLmxGarA405vk6DeS7PcpiWVWUkjQpa5bTXtw imNHQmc//yP8wMczwT/q31LhxRuVQ3PztHy6xrcJqcEClxFKXOEmPOhTnylVzlIbpK7w axDg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w9si8476285eds.522.2020.09.07.00.58.33; Mon, 07 Sep 2020 00:58:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727908AbgIGH4Q (ORCPT + 99 others); Mon, 7 Sep 2020 03:56:16 -0400 Received: from mail-oi1-f195.google.com ([209.85.167.195]:45072 "EHLO mail-oi1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727847AbgIGHz7 (ORCPT ); Mon, 7 Sep 2020 03:55:59 -0400 Received: by mail-oi1-f195.google.com with SMTP id d189so12821566oig.12; Mon, 07 Sep 2020 00:55:58 -0700 (PDT) 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=uuBwypJmHWQd5+fhA+Qi5ygJwZd3WxmHZlgvS26xGCM=; b=GtOSW2MJgduv5NPEDLskPJLOojRpBiRg3hHAx5UNhBY8LlJ6aKraRwa1+s/vMj7xZF etwr8rUWgVySyHcNTzD6seOgivEmMWPRaobsPpAnrJK/fU7eQAefoTZU1KP6IyuIMJxh FRCSEF85pvpMvMfrLKt/ohLojmPph3+T6obI40Qod5NYHBwqdPA8vNVv6xUXWdUYpByw zJr+m8IXEqAeptEMmLgXx33H/ERFocolgAG8uAuz+MeUW25kDQc299VI8AG41S1OykwV TtDMq4RAcWqQtrVC0qc+1/E50u+sZIXhZPbMYbN2Bm6XhOBSqFtBdjtrSfaseFSgfUxK 1qmw== X-Gm-Message-State: AOAM5334dcRNXxsfmCCWQhh+9zZiGg4u0z3FBRlBWq9TRXYxpUDYzlDP e+4Hgc6WCKSq5amCKXgS8EdaLAc0QK2J3Tov0rs= X-Received: by 2002:aca:52d6:: with SMTP id g205mr11714334oib.54.1599465358239; Mon, 07 Sep 2020 00:55:58 -0700 (PDT) MIME-Version: 1.0 References: <20200825162718.5838-1-prabhakar.mahadev-lad.rj@bp.renesas.com> <20200825162718.5838-5-prabhakar.mahadev-lad.rj@bp.renesas.com> In-Reply-To: From: Geert Uytterhoeven Date: Mon, 7 Sep 2020 09:55:46 +0200 Message-ID: Subject: Re: [PATCH 4/4] ARM: dts: r8a7742-iwg21d-q7: Enable SD2 LED indication To: "Lad, Prabhakar" Cc: Lad Prabhakar , Magnus Damm , Rob Herring , Linux-Renesas , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux Kernel Mailing List 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 Hi Prabhakar, On Fri, Sep 4, 2020 at 7:15 PM Lad, Prabhakar wrote: > On Thu, Sep 3, 2020 at 1:20 PM Geert Uytterhoeven wrote: > > On Tue, Aug 25, 2020 at 6:28 PM Lad Prabhakar > > wrote: > > > Add support for LED trigger on SD2 interface. > > > > > > Signed-off-by: Lad Prabhakar > > > Reviewed-by: Chris Paterson > > > > > --- a/arch/arm/boot/dts/r8a7742-iwg21d-q7.dts > > > +++ b/arch/arm/boot/dts/r8a7742-iwg21d-q7.dts > > > @@ -63,6 +63,16 @@ > > > enable-gpios = <&gpio3 11 GPIO_ACTIVE_HIGH>; > > > }; > > > > > > + leds { > > > + compatible = "gpio-leds"; > > > + > > > + sdhi2_led { > > > + label = "sdio-led"; > > > + gpios = <&gpio5 22 GPIO_ACTIVE_LOW>; > > > > GPIO_ACTIVE_HIGH? > > > > The LED is driven by an NPN transistor, with the LED between 3.3V and > > the transistor's collector. Oops, 3.3V is not VCC_3V3, but SD_3V3, so it is not always-on, but controlled by SDIO_PWR. > I did try with GPIO_ACTIVE_HIGH and it didn't work as expected. To > make sure I can control the LED through sysfs I deleted the node from > DTS and exported the pin GP5_22 (858) and writing the value "out" > direction and setting the values 0/1 to value did not toggle the SDIO > LED as expected and it stayed OFF all the time. Hence when SDIO_PWR is turned off, you cannot control the LED just by toggling GP5_22. > Looks like there is some information missing in the schematics. > > I did some experiments. I completely removed the SDHI, LED and > regulator nodes and booted the system and exported GP1_27 (989) and > wrote values 0/1 and this toggled the SDIO_LED. > > U-boot sets the below, so in u-boot the SDIO_LED is ON: > gpio_direction_output(GPIO_GP_1_27, 0); /* power on */ > gpio_set_value(GPIO_GP_1_27, 0); > gpio_direction_output(GPIO_GP_5_22, 0); /* LED */ > gpio_set_value(GPIO_GP_5_22, 1); > gpio_direction_output(GPIO_GP_1_8, 0); /* 1: 3.3V, 0: 1.8V*/ > gpio_set_value(GPIO_GP_1_8, 1); > > So in comparison we would need a hog node as below (and with this the > LED triggers correctly as expected), > > &gpio5 { > sdio-led-gpio { > gpio-hog; > gpios = <22 GPIO_ACTIVE_HIGH>; > output-high; > line-name = "sdio-led-gpio"; > }; > }; > > Let me know if you are OK with the above. The above means the LED is always lit when SDIO_PWR is enabled. While I agree that's some kind of SD activity indicator, probably it's less fine-grained than using the mmc1 trigger? I assume the mmc1 trigger is only activated when SDIO_PWR is enabled. Are you sure this doesn't work? Perhaps your kernel was missing SD trigger support, or "mmc1" is the wrong SD instance? > Looks like the SDIO_PWR is tied up with an SDIO_LED pin and the > information is missing from schematics. No, I think we just misread the schematics. Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds