Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3284698pxk; Mon, 7 Sep 2020 08:28:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXoXMfAi2NwBwoBiv9qOHNMV43q+ZBRJGgnE8VJLSTg7AlT5FGKqcGUWjg4Q3Hm6AfW8eE X-Received: by 2002:aa7:c347:: with SMTP id j7mr3751277edr.185.1599492502538; Mon, 07 Sep 2020 08:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599492502; cv=none; d=google.com; s=arc-20160816; b=sT3PthVFyWoMUfQqWaQrKrhRkktHZVjYee1/399vPDwXvX2RDKxM1P3YJKT7gWGAJP 1nw6advX55Ih86GBXpiZ6SHLAA8H6jJL1mNaf87Vk4D3Xc3HgD2cSM0nv4mp1RdQoJ7l WneMCr5YGzImJFu0z0X5KmIoXmJNv9KSxdyXjQiAXbS1IBfoZetBFj++/gN5vGXMRNZV dbIeX5cmR73LCG/R5wwv/oTA1a83cRiobN/tptg4se6ORXQiUo9uWnLeKjKapGorrG7U xkbCOyMvzgcz3VKnlgFTDyIDd+9v4CIgAsCQ2CDfF7IkXEAK9LKvv8ZNB/Zgeo282qKV gJWg== 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=atNQu443wohaZMIITwmFzOCQT4mAdD+gEFufNnG4IJE=; b=ELo5i3n9MDQERgpN5HkJcE6MZ59oaURN3JNM7fgxZ9F+zwnmnCCC2QgMi+TDukUBJ+ 2q0kLncuZKp9Nx6WPNvv4EOaHm5F7O8nN8l7Q1zT4W91qSN64xV5iBvjzRLLPU+Qqlt/ Ic0AFRc6MdwtzCIRJqz8VpZEqA92san3G84n71nuhBS1yjCpFTZsckBZbMviscjL906t UY1VQiejyrWtHyhQzC9t17P1qZnBoT4TfvVIPvLspAAxefuzmH0ORoTFEBf0gD/SVsK7 qK3xlTZmJFYtO75GX5P5eg1s2sTAoxqEDbbx6bgt4UIsutCvsH18LEm36krhAWze+m1J xTVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZSd/QbpL"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o2si9693213ejm.676.2020.09.07.08.28.00; Mon, 07 Sep 2020 08:28:22 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b="ZSd/QbpL"; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730185AbgIGPZE (ORCPT + 99 others); Mon, 7 Sep 2020 11:25:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730153AbgIGPXj (ORCPT ); Mon, 7 Sep 2020 11:23:39 -0400 Received: from mail-yb1-xb44.google.com (mail-yb1-xb44.google.com [IPv6:2607:f8b0:4864:20::b44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2FF5C061573; Mon, 7 Sep 2020 08:23:37 -0700 (PDT) Received: by mail-yb1-xb44.google.com with SMTP id r7so9411736ybl.6; Mon, 07 Sep 2020 08:23:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=atNQu443wohaZMIITwmFzOCQT4mAdD+gEFufNnG4IJE=; b=ZSd/QbpLkn/LjM7Y2du9R/pLZypRLQpjjYyVcOS0+/oHAl7CvAy0/+UAWQPn7BL4bj E2HUCzUQIo2TIJ+bosFjR3mQgxKe9GEJAdilc0QEIv/p+HnNDN+wT/BjrwWhGNPIFXha q3n3OJcCIfARs/2DIW/iaCoVvQ0jSChSm7RC+IF5L4h9dB19N3x7fXYvT5VLH7pax8mk fbMVrgI/VzOlUaZEOArUfRo0Y+DwEHLvfQhUaUwSQmDw10tKrrVeHJ2BGvavpeNQYB+a ETZgnbtU1Wrj4kHJ0EHhTbcGWmWZF/yoKBNX62U3xrEXa4PDMeVmvDoFbM9pHCvsOHWk qCgQ== 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=atNQu443wohaZMIITwmFzOCQT4mAdD+gEFufNnG4IJE=; b=gmLS6DwIOIYwyIe+Gv54Ypo/4nUfTmKn/LD5DY9JsLFUDkuZuFOJq9hNsFn32EXQpT y03HSToFHv6HP2VNcMBi3pp9+mWRvWcui/T82tzC2odkPxLiiLfQgtPey5tZExTuVwFS s6yx8OvS/POtnArKxZTGmvUuSt4xlvlsJj3FZu46Cr8ZAtNyIk2P8Gu5FWTTZqcoHX57 JwdxqvN70MldelE0t5NBAlpuk9jCog5ph+0OSWs1ZBoRRh+Al34uT+hhgHWtJsOfcKnh PXfLKboNOcVfuvzbSW8KU6h2UGXHCIKcv6fSORiEHLvvyyinYDdprNCVf71bb8AjiFtO cDsA== X-Gm-Message-State: AOAM533Cx0mpLB9uNh9AR3/mVd2smPnBl2crdTY3Z4Knqu3z58V2yLAX uX9BHAICmqQ9XXYVZFHFHizk8O8NNOuIHXPcZBJCGUDrkppgrg== X-Received: by 2002:a25:7608:: with SMTP id r8mr30831434ybc.518.1599492215825; Mon, 07 Sep 2020 08:23:35 -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: "Lad, Prabhakar" Date: Mon, 7 Sep 2020 16:23:09 +0100 Message-ID: Subject: Re: [PATCH 4/4] ARM: dts: r8a7742-iwg21d-q7: Enable SD2 LED indication To: Geert Uytterhoeven 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 Geert, On Mon, Sep 7, 2020 at 8:55 AM Geert Uytterhoeven wrote: > > 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. > My bad I misinterpreted the trigger, with GP5_22 being GPIO_ACTIVE_LOW the LED remained ON when the card was inserted and turned OFF when the card was pulled out. When GP5_22 being GPIO_ACTIVE_HIGH the LED blinked and stayed OFF when the card was inserted and remained OFF when the card was pulled out. As a result I misinterpreted it. I can confirm when GP5_22 is GPIO_ACTIVE_HIGH and there is any activity on SD (read/write) the led turns ON. Cheers, Prabhakar