Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp317414pxj; Wed, 23 Jun 2021 23:16:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyE+sKQWG+8MtC75S5ZGloNB5IxTe+pDbR621vhvedR4hE4jn7DVXCdK5ffC9GnuBYhuggN X-Received: by 2002:a17:906:b857:: with SMTP id ga23mr3675117ejb.296.1624515407606; Wed, 23 Jun 2021 23:16:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624515407; cv=none; d=google.com; s=arc-20160816; b=dFPTbJAcM+MzbCy3fJJ50QhRdmbnOadMkj0nAC0HPUl2YvLMVDlw6QKBrjTLHSYuiX x2Nyzr2ClDY4XmB80LC3j/G8/hEdV/wIwMxKJhaLfTV+rJsM2jvdJniMpI/+0BIvkDib z1MPxxnaudITpZ8ZHqUUIcmrKjUGKgdKxwMYouBMHOsE7lu0cmxJh6uGSE1MX/MKZwxe l+Guz8EyAcVWqSA9y2oQG+4pMbMTn+/qDERux19dLMD4cuHtAUIhxdnzm4976+PJLbRK X4t/T4ZEfg8RfmJbkyGlfkQ2WBIjWvrSp9yyO6NSlWAzbcTSwcRJF+NeCUx8CFGJaQVH nAfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:subject:cc:to:from; bh=W1mVUh+3AB/wpDOxed5UiQrZjr1Joh7HKLnNOVOmY/8=; b=iOF+MVXWTy82Gd89KTvXcHj8si4wZ0qfYieCMcphMzMKFmPLORyhKI8kxQ/ReaNkyH EFbqG3YX658GJME/C1PYj0fkJKYUF5l49Y7KU4s6kQQUB5OJS3MBm8xKmWFUZQ/52XwH AdXWT+bFBtGn3XS/dEpvX4boIvSIYtwU4FAIERiUFw4rUvBTe2hMv1aQTMkPeRNFv/2i k5MW8goJJ97CW5Hi64zMZq9g2snVM3ZEdvANb7RrQ6rlbkLCNJFX3IV42nlXEudyibqh bmXEHnHLFIm9N89RU7DkTWRx10BTF8KnU9zQAgLm3/0roSrc/bRkL3zFZ1xC1Q4Z2Eji ti3w== 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 og49si1817578ejc.607.2021.06.23.23.16.24; Wed, 23 Jun 2021 23:16:47 -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 S231262AbhFXGRI (ORCPT + 99 others); Thu, 24 Jun 2021 02:17:08 -0400 Received: from smtp1.hiworks.co.kr ([121.254.168.204]:19798 "EHLO smtp1.hiworks.co.kr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230393AbhFXGRI (ORCPT ); Thu, 24 Jun 2021 02:17:08 -0400 Received: (qmail 141388 invoked from network); 24 Jun 2021 15:14:45 +0900 Received: from unknown (HELO hiworks.co.kr) (192.168.21.201) by 0 (qmail 1.03 + ejcp v14) with SMTP; 24 Jun 2021 15:14:45 +0900 Received: (qmail 29379 invoked from network); 24 Jun 2021 15:14:45 +0900 Received: from unknown (HELO localhost.localdomain) (tykwon@m2i.co.kr@58.75.176.98) by 0 (qmail 1.03 + ejcp v14) with SMTP; 24 Jun 2021 15:14:45 +0900 X-Authinfo: HIWORKS SMTP authenticated From: Kwon Tae-young To: Ulf Hansson Cc: Kwon Tae-young , linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] mmc: core: Added support for LED trigger only when SD card is connected Date: Thu, 24 Jun 2021 15:14:17 +0900 Message-Id: <20210624061418.30361-1-tykwon@m2i.co.kr> X-Mailer: git-send-email 2.17.1 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org led_trigger_event() is always called. In this case, if the LED trigger is set to the SD Card, the trigger will occur even when the SD card is not connected and the LED will blink. In case of SD Card, it is judged based on Card Detection information and changes to generate LED trigger only when SD Card is connected. Board tested: NXP i.MX 8M board Signed-off-by: Kwon Tae-young --- drivers/mmc/core/core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f194940c5974..b3156f6c5cfa 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -352,7 +352,11 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq) if (err) return err; - led_trigger_event(host->led, LED_FULL); + if (host->ops->get_cd) + host->ops->get_cd(host) ? led_trigger_event(host->led, LED_FULL) : NULL; + else + led_trigger_event(host->led, LED_FULL); + __mmc_start_request(host, mrq); return 0; -- 2.17.1