Received: by 10.192.165.148 with SMTP id m20csp1702767imm; Thu, 26 Apr 2018 00:37:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo07tYS+OXFrJCEH5sDPNq8iuPpQ3a3bZOdcbMGaSnVNjBuHOz1dtGdbPu28MTN90aSs4w8 X-Received: by 2002:a17:902:9688:: with SMTP id n8-v6mr8580029plp.366.1524728234784; Thu, 26 Apr 2018 00:37:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524728234; cv=none; d=google.com; s=arc-20160816; b=CrV4SB7JDolXkSkWqrSG/gmlXe425ENqPwkzgvDuNZgFbJrtwHINfAj4GAeeOO2bh+ qj4I6v+Di6OT036w4rRVGnthc8gC50H/yo3f/v18T0KeAoaC01Ji58RkCSyGWB8qsNZm j60hwZQ+WCJakzJaq6mdR++8SmBAbZKzj2z0iWgnj0SfBIknLcnD8DhGWgzX+z0mCCCk N9EMrVIcSb8yf/w1rh074cbuxt4ff7bbzjFcNWgUdyRAooM9EwzvFQkQ/7FyGMq1sH5L sclEDZE5Wn7fS/k7npYJmASJbPDPuZJwTcSMbjSxS+3zYyUnZx8NZ0yQ+vCkuPTDiukI bsjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature :arc-authentication-results; bh=9Z8O3C+6D3VayrCyYk+e8NdLM+JmDyQwLGmeiY/XLq8=; b=l+vGnwCBQ59uHiMayqeefuzA8laBbVFDR0gXgNhf6cn05J0HUAMbskOX4llxaYT8hl m2pGi+6n0fKUELBEugphyrAll0OGUPuIsZeMULwPNC9xrjCqhhK5YUUp6BdRMzLswVMN ui+/NXzOJONfug/h9uc7Fe/CPOQEE2dBZd1hTsDKmNdaHQPr6wqGLpCAqTfk3GsKVGEp SEcsyOkmvoP5anVQOxbcArYXgYWbCISJoF5OYbgXoB3S9mBjGz2sodfEj1qaK+VgBxGl 9jzmiMUM604lxHo++PvjZM0LG38tfWNH3kJhgLBUcSRKFksinWdVwYyAzNBTaIluUTXW SQ7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=ahJjz854; 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 h67si13696426pfk.15.2018.04.26.00.37.00; Thu, 26 Apr 2018 00:37:14 -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=ahJjz854; 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 S1754163AbeDZHe1 (ORCPT + 99 others); Thu, 26 Apr 2018 03:34:27 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:36486 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753403AbeDZHeZ (ORCPT ); Thu, 26 Apr 2018 03:34:25 -0400 Received: by mail-wr0-f196.google.com with SMTP id u18-v6so28396950wrg.3 for ; Thu, 26 Apr 2018 00:34:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=9Z8O3C+6D3VayrCyYk+e8NdLM+JmDyQwLGmeiY/XLq8=; b=ahJjz854eI6gYOANel+n2NXvpXBR3Yf2KU+6m2Yp/CXiZjVSFydzat+DvUzydmSZDn vVvEDFwl6CA+75fJ7LVC8Sw2+I/55mCNvdLA8m0cDGwg0UuJE1LMyy0EGF1T8edRtxcm qBGaJdpngJYCygKA/QIAEncGEMsOkoTz0L0SA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=9Z8O3C+6D3VayrCyYk+e8NdLM+JmDyQwLGmeiY/XLq8=; b=LJgd22AesEA4lwzGA+CVaPlf2FvVI2GUhI5suGF/eQkYlFTEfOoOoTsQk4UfKtcBuo 6rW5/zynoDkfzk5RS+1wgzwoRBGMdQeFjHJQNQLTm3lRMwijFTopJ3ixEugO0iVw/We6 Zbe/AmiB+kU/D4Gfs3KGxVR/EraSGhDt4LhB6VaIy00aZblhR+++952FGGWP3R1Md6Ck fU3OtaE+3tLR0U88Wb/yibpaUgLLYHrYvp0RfbQSH+2bB6S/nJA/4SXVp7gdaqrAE9GG yfSQ6DVbnAM5+2TxYwe2fNwNiefjcfwCkksx6reZcJrq80js1CIvtvUSIYePEfsofwvx stxg== X-Gm-Message-State: ALQs6tBS+C43lTjKCnxjbAPMssy7mvG6+3sh08Do6Y1mZdGuuUuljR3p 8NyFNHBRaoDkZ8WnAYrBzyDQ/A== X-Received: by 2002:adf:a673:: with SMTP id k106-v6mr27182980wrc.231.1524728063786; Thu, 26 Apr 2018 00:34:23 -0700 (PDT) Received: from dell ([2.27.167.55]) by smtp.gmail.com with ESMTPSA id b57-v6sm29995063wra.9.2018.04.26.00.34.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 26 Apr 2018 00:34:23 -0700 (PDT) Date: Thu, 26 Apr 2018 08:34:05 +0100 From: Lee Jones To: Javier Arteaga Cc: Jacek Anaszewski , Pavel Machek , Dan O'Donovan , Andy Shevchenko , Mika Westerberg , Heikki Krogerus , Linus Walleij , linux-gpio@vger.kernel.org, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH RESEND 2/3] leds: upboard: Add LED support Message-ID: <20180426073314.g2ccjjkx6vgbknhm@dell> References: <20180421085009.28773-1-javier@emutex.com> <20180421085009.28773-3-javier@emutex.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20180421085009.28773-3-javier@emutex.com> User-Agent: NeoMutt/20170609 (1.8.3) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 21 Apr 2018, Javier Arteaga wrote: > Allow userspace to use the on-board LEDs as "upboard::". > > Signed-off-by: Javier Arteaga > --- > drivers/leds/Kconfig | 10 +++++ > drivers/leds/Makefile | 1 + > drivers/leds/leds-upboard.c | 87 +++++++++++++++++++++++++++++++++++++ > drivers/mfd/upboard.c | 19 ++++++++ This change needs to be placed into a separate patch. > include/linux/mfd/upboard.h | 5 +++ > 5 files changed, 122 insertions(+) > create mode 100644 drivers/leds/leds-upboard.c [...] > diff --git a/drivers/mfd/upboard.c b/drivers/mfd/upboard.c > index 8bae450cb83d..6e4767e4dc41 100644 > --- a/drivers/mfd/upboard.c > +++ b/drivers/mfd/upboard.c > @@ -79,6 +79,14 @@ struct upboard_data { > size_t ncells; > }; > > +#define UPBOARD_LED_CELL(led_data, n) \ > + { \ > + .name = "upboard-led", \ > + .id = (n), \ > + .platform_data = &led_data[(n)], \ > + .pdata_size = sizeof(*(led_data)), \ > + } > + There is a subsystem-level MACRO currently being reviewed on the list. Just use the full format in your structs for now. > /* UP Squared */ > > static const struct regmap_range upboard_up2_readable_ranges[] = { > @@ -116,7 +124,18 @@ static const struct regmap_config upboard_up2_regmap_config = { > .wr_table = &upboard_up2_writable_table, > }; > > +static struct upboard_led_data upboard_up2_led_data[] = { > + { .id = 0, .color = "blue" }, > + { .id = 1, .color = "yellow" }, > + { .id = 2, .color = "green" }, > + { .id = 3, .color = "red" }, > +}; How is this data used? Does it ever change, from board to board? > static const struct mfd_cell upboard_up2_mfd_cells[] = { > + UPBOARD_LED_CELL(upboard_up2_led_data, 0), > + UPBOARD_LED_CELL(upboard_up2_led_data, 1), > + UPBOARD_LED_CELL(upboard_up2_led_data, 2), > + UPBOARD_LED_CELL(upboard_up2_led_data, 3), > }; > > static const struct upboard_data upboard_up2_data = { > diff --git a/include/linux/mfd/upboard.h b/include/linux/mfd/upboard.h > index d9dd214f4d29..eed68caa23ce 100644 > --- a/include/linux/mfd/upboard.h > +++ b/include/linux/mfd/upboard.h > @@ -62,4 +62,9 @@ struct upboard { > struct gpio_desc *dataout_gpio; > }; > > +struct upboard_led_data { > + unsigned int id; > + const char *color; > +}; If this is going to stick around, which I'm not sure it should, you need to document it (using kerneldoc format), since 'id' is quite ambiguous. > #endif /* __LINUX_MFD_UPBOARD_H */ -- Lee Jones [李琼斯] Linaro Services Technical Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog