Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp7900043ybl; Thu, 16 Jan 2020 07:26:24 -0800 (PST) X-Google-Smtp-Source: APXvYqwujNMSEwBJu2ZWaEfQXeg53G2IdowxuIc0GXqll0IkI62WvTPwDlUohsg6uSoKEaIME1y7 X-Received: by 2002:a9d:7:: with SMTP id 7mr2311463ota.26.1579188384323; Thu, 16 Jan 2020 07:26:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579188384; cv=none; d=google.com; s=arc-20160816; b=SKl8beqEWtYMIu9qt0a48/Ogu17L7Xrj+eynoDKt0cXZaWPy1Yj7BJ23RaQtYW3SYz bxn/Rr8w8JQ6FIZlw1v4DSkCE9ibMPJx4dxii8BLL/mwOLWHcW9X0ZsYbmbcN+ItbriT PEBHDaFWTHBC2ElwLKfT06wAE4Xh4CZBgK8tOiCxE/15/Kd1mXl8STCKbI3sbqVOTKn5 7d4mJlqyD+3yIQ6IV2KARMm4TNpols5EOStPtdij0i0sgW1PlcM7jWyZ0Rt2wrCSs4UD tGIt7u/TAG4U67C1G+70++4GjDvCWaf2kTKoVhVzhuX/3TqxZwJAbwtTxaPKS6nq9t3Q oClA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=Tf129wgmRT3W3nq93jyOsnWCVa9uRqpmqZ5E47xgQ1A=; b=ysV44Z5IZBnZhhzBsFz1o4QVuWU61SKjcDmMH/fLDmrWy2mc7wuS+y3NwOhAk2XbXp qrsGd0+MtOLM4IEfljJSvv2q3xT/78loGX/r5gQkjuckaz/EoXXcS+dQLptCmX31aSYH gkx0J7jq9XIkdHQxfamtmYq8UIDqgS5hGUesuThl3VT4Nqg1+EqOc1bn0J7EkAji9eac kcXJldMUzT83c6fTxcBriEnmxHQGd2b5wJdEb0406oMBo9sfXxxDZaa7OJeDFw2U8eMM 4zz3PCX0xLWoJSoSbvn93MuSfAOn/CBT38OEhskslWeDogoApX6nUCw0n4yqPNxtA/oA PXWg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=D0yRpzia; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u15si11434533oie.265.2020.01.16.07.26.10; Thu, 16 Jan 2020 07:26:24 -0800 (PST) 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=@ti.com header.s=ti-com-17Q1 header.b=D0yRpzia; 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=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726706AbgAPPZH (ORCPT + 99 others); Thu, 16 Jan 2020 10:25:07 -0500 Received: from lelv0142.ext.ti.com ([198.47.23.249]:42712 "EHLO lelv0142.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726410AbgAPPZH (ORCPT ); Thu, 16 Jan 2020 10:25:07 -0500 Received: from fllv0034.itg.ti.com ([10.64.40.246]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 00GFOx7b098767; Thu, 16 Jan 2020 09:24:59 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1579188299; bh=Tf129wgmRT3W3nq93jyOsnWCVa9uRqpmqZ5E47xgQ1A=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=D0yRpziaqpENz0Vs/lLN+sAJbzEerf6STQwQsDywZQYTOkqmo+U8eb53JnG7+BiPE slvLazi/1i7U4iSFSi0CvHA3avvPQvvYVh1sBU92qs/mbDT71ZMuoRgSPImB4i/900 eru/u4a54tJMTpq1Wv8ZwjX8UCJ/B4Gec2vjiyHs= Received: from DLEE109.ent.ti.com (dlee109.ent.ti.com [157.170.170.41]) by fllv0034.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 00GFOxc9102915 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 16 Jan 2020 09:24:59 -0600 Received: from DLEE103.ent.ti.com (157.170.170.33) by DLEE109.ent.ti.com (157.170.170.41) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3; Thu, 16 Jan 2020 09:24:59 -0600 Received: from lelv0327.itg.ti.com (10.180.67.183) by DLEE103.ent.ti.com (157.170.170.33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1847.3 via Frontend Transport; Thu, 16 Jan 2020 09:24:59 -0600 Received: from [10.250.65.13] (ileax41-snat.itg.ti.com [10.172.224.153]) by lelv0327.itg.ti.com (8.15.2/8.15.2) with ESMTP id 00GFOwbq125808; Thu, 16 Jan 2020 09:24:58 -0600 Subject: Re: [PATCH] leds: add SGI IP30 led support To: Thomas Bogendoerfer CC: Jacek Anaszewski , Pavel Machek , , References: <20200115130536.11453-1-tbogendoerfer@suse.de> <20200116120545.2f4a907b9ddda84e76e445e1@suse.de> From: Dan Murphy Message-ID: <4a6dd4c6-4719-6662-a5ac-eef9a4112c2e@ti.com> Date: Thu, 16 Jan 2020 09:21:59 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <20200116120545.2f4a907b9ddda84e76e445e1@suse.de> Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Thomas On 1/16/20 5:05 AM, Thomas Bogendoerfer wrote: > On Wed, 15 Jan 2020 07:46:13 -0600 > Dan Murphy wrote: > >> Thomas >> >> On 1/15/20 7:05 AM, Thomas Bogendoerfer wrote: >>> This patch implemenets a driver to support the front panel LEDs of >>> SGI Octane (IP30) workstations. >> Thanks for the patch >> >> Some nitpicks below >> >> >>> Signed-off-by: Thomas Bogendoerfer >>> --- >>> drivers/leds/Kconfig | 11 ++++++ >>> drivers/leds/Makefile | 1 + >>> drivers/leds/leds-ip30.c | 82 ++++++++++++++++++++++++++++++++++++++++ >>> 3 files changed, 94 insertions(+) >>> create mode 100644 drivers/leds/leds-ip30.c >>> >>> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig >>> index 4b68520ac251..8ef0fe900928 100644 >>> --- a/drivers/leds/Kconfig >>> +++ b/drivers/leds/Kconfig >>> @@ -836,6 +836,17 @@ config LEDS_LM36274 >>> Say Y to enable the LM36274 LED driver for TI LMU devices. >>> This supports the LED device LM36274. >>> >>> +config LEDS_IP30 >>> + tristate "LED support for SGI Octane machines" >>> + depends on LEDS_CLASS >>> + depends on SGI_MFD_IOC3 >> What is the dependency on the MFD? > the gpio lines where the leds are connected are managed by the mfd ioc3 driver. > So without that driver this led driver will not be started. Ack > >>> + >>> + >>> + if (num == 0) { >>> + data->cdev.name = "ip30:white"; >> This also needs a function as defined in dt-bindings/common.h >>> + data->cdev.default_trigger = "default-on"; >> The name, color, function and trigger can be pulled from the DT or Firmware. >> >> The firmware should contain a node for each LED to be configured. > SGI Octanes don't have DT and the firmware just toggles some of the leds, > but doesn't provide informations about it. That's why this is hardcoded > in the driver. The MFD driver detects the ioc3 chip and knows it's a > SGI Octane mainboard and creates the led platform device. > > How is the correct way to this without DT ? Please refer to the leds-class document (1) under LED device naming convention If you don't have a DT then set the name accordingly.  The functions are defined in the common.h and the colors are exported in the leds-class driver 1 https://www.kernel.org/doc/Documentation/leds/leds-class.rst > >>> + } else { >>> + data->cdev.name = "ip30:red"; >> Same as above >>> + data->cdev.default_trigger = "panic"; >>> + writel(0, data->reg); >> Is the LED on by default? > Depends on the hardware state. If PROM firmware detects some hardware issues, > it turns on the red LED. Otherwise it's off. So why would we turn it off if the PROM FW turned it on? Dan