From patchwork Thu Aug 27 08:08:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 11740263 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 44CE5739 for ; Thu, 27 Aug 2020 08:11:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B2CF2177B for ; Thu, 27 Aug 2020 08:11:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="uirdamO7" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727970AbgH0ILK (ORCPT ); Thu, 27 Aug 2020 04:11:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727961AbgH0ILK (ORCPT ); Thu, 27 Aug 2020 04:11:10 -0400 Received: from mail-lj1-x244.google.com (mail-lj1-x244.google.com [IPv6:2a00:1450:4864:20::244]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C59A0C06121A for ; Thu, 27 Aug 2020 01:11:09 -0700 (PDT) Received: by mail-lj1-x244.google.com with SMTP id v12so5379126ljc.10 for ; Thu, 27 Aug 2020 01:11:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mTDjea0nrnc/oUf1mH0xhxoad77z5EY9HZKwtaJ59yw=; b=uirdamO7+rR5SAWOIOIS1iNHhmUE9SNEGnKOpzsy3KEjjxJYTzUq4iKDX6lnKYaM/c uit2YGPT2391mXTRCqyZ5aVSIyKxAP/3jdviEIJ6Ngh4tTWeAIZvFrNwlC0K04/YFtA+ XvF/Ywee2+tTtwMN3lVngnu7ilm1nXloqJ6W+EPTYEUouwKrBDsyxkF5AhK1/LCCHz/R uUoNt8xK1BA1OZdUzfhFdcNKKy7xcE/VeeUroiHLuxIgkA1Nl4h6i7BQjgHHtMyXMX5S dBhKU0ivZWVg6guh22ilnYztwna081mQpDbWh/eM1KTgzeYk0F/JOTHci0Zmx6gI5gV/ 0+8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mTDjea0nrnc/oUf1mH0xhxoad77z5EY9HZKwtaJ59yw=; b=tuHY1iUkdzAhbdP75dOU/FiIXTCfK1pgqjJ5GK1h8sdhznQbbTsPbXC+t08O207puC oId/XqLSXx7sIG73cnWShMARhvtZ8qFr0z39tBM3nI+bUThYolw/iNoMhrG2c1Tz+TdK Hz4ohZ2RM1TnWOuO7I/TqzRFMA9qS3de3bqbQoq7FJzwHrxzP+wjkxOTcg8Bsp0jNg+e yt1SW2TeP+sEmDkW59t8bXyIiMoYdKmdtaKz7Q7pw4SsoqYVJgp0XwM83DiBAhLeEuAh +n1s2cFwh07Vd22+HnkGyLiHUXDEyRNDp3CKb6KoaY/9jT42tJptPOuq+k+kidBcUiUW YjgQ== X-Gm-Message-State: AOAM530kEjwpHxWbOSwsdkIv3wQI0J3UdDi0f4cMuZB24ni49f/zPt+P yQR9NbqYwWYqqVs3n7NlGdaniA== X-Google-Smtp-Source: ABdhPJyRstwt15FW2tCgyXcxsm171w+Ez5d25HjrfBMbO57M/xguEMGD7UE6V7DxRS4LjhWqtznf7w== X-Received: by 2002:a2e:9ac5:: with SMTP id p5mr9639088ljj.253.1598515868229; Thu, 27 Aug 2020 01:11:08 -0700 (PDT) Received: from localhost.localdomain (c-92d7225c.014-348-6c756e10.bbcust.telenor.se. [92.34.215.146]) by smtp.gmail.com with ESMTPSA id k9sm331399lfm.29.2020.08.27.01.11.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Aug 2020 01:11:07 -0700 (PDT) From: Linus Walleij To: Darren Hart , Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org, Linus Walleij , linux-gpio@vger.kernel.org, linux-geode@lists.infradead.org, Andy Shevchenko Subject: [PATCH 3/3 v2] x86/platform/geode: Convert alix LED to GPIO machine descriptor Date: Thu, 27 Aug 2020 10:08:26 +0200 Message-Id: <20200827080826.186024-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200827080826.186024-1-linus.walleij@linaro.org> References: <20200827080826.186024-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@vger.kernel.org This makes the machine look up the LED from a GPIO machine descriptor table. The Geode LEDs should be on the CS5535 companion chip. Cc: linux-gpio@vger.kernel.org Cc: linux-geode@lists.infradead.org Cc: Darren Hart Cc: platform-driver-x86@vger.kernel.org Reviewed-by: Andy Shevchenko Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Drop excess comma after terminator { } - Collect Andy's Reviewed-by --- arch/x86/platform/geode/alix.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/arch/x86/platform/geode/alix.c b/arch/x86/platform/geode/alix.c index c33f744b5388..b39bf3b5e108 100644 --- a/arch/x86/platform/geode/alix.c +++ b/arch/x86/platform/geode/alix.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -69,21 +70,15 @@ static struct platform_device alix_buttons_dev = { static struct gpio_led alix_leds[] = { { .name = "alix:1", - .gpio = 6, .default_trigger = "default-on", - .active_low = 1, }, { .name = "alix:2", - .gpio = 25, .default_trigger = "default-off", - .active_low = 1, }, { .name = "alix:3", - .gpio = 27, .default_trigger = "default-off", - .active_low = 1, }, }; @@ -92,6 +87,17 @@ static struct gpio_led_platform_data alix_leds_data = { .leds = alix_leds, }; +static struct gpiod_lookup_table alix_leds_gpio_table = { + .dev_id = "leds-gpio", + .table = { + /* The Geode GPIOs should be on the CS5535 companion chip */ + GPIO_LOOKUP_IDX("cs5535-gpio", 6, NULL, 0, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("cs5535-gpio", 25, NULL, 1, GPIO_ACTIVE_LOW), + GPIO_LOOKUP_IDX("cs5535-gpio", 27, NULL, 2, GPIO_ACTIVE_LOW), + { } + }, +}; + static struct platform_device alix_leds_dev = { .name = "leds-gpio", .id = -1, @@ -106,6 +112,7 @@ static struct platform_device *alix_devs[] __initdata = { static void __init register_alix(void) { /* Setup LED control through leds-gpio driver */ + gpiod_add_lookup_table(&alix_leds_gpio_table); platform_add_devices(alix_devs, ARRAY_SIZE(alix_devs)); }