Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2484433ybc; Sun, 17 Nov 2019 22:58:29 -0800 (PST) X-Google-Smtp-Source: APXvYqzJ+QL3wQwbYGiVctaGiUSPMBpUHUuFu8/8Rk0Myg1WvyMOA9z2xlZiddAtRcPwt2/3lAmw X-Received: by 2002:a17:907:1102:: with SMTP id qu2mr24170283ejb.300.1574060309036; Sun, 17 Nov 2019 22:58:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574060309; cv=none; d=google.com; s=arc-20160816; b=EziobBFfmceOlJ2jOqsNoslGQXinn7U3IB/N6aNP2T2bE4n0A2qs+1BhEXLzVBOYCY M6XRb2+WxI040olEZqdRcCXbvIRfUDH25AC/umL0YsOXUBpwp7PS1uQYl8Oj3uctTWPk BZS2XPtT9VIGvJWoQhSkmBlJJzfpB1UmUTmgjwf810n5XTwDq2F6zXEctwETXTk0Oso9 /cE0c/ZU1YszOCPY5VVql/bYmyabitf7QNVC/iLKB1yTZww8ttGPlkkeZNiVu2ijmiKy cY/Rn6wTzCcqRykp3gdcMtevbjX/Ghz63bFwwHY0XMrY2paL/Oy/9CkbCTIe78ovhevN agUQ== 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-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ZilPVsgy6B4aFkcKkLwJzf3PfDFkHFr/6jpNuKdup0M=; b=r3ball1uPh9XjbWEbDEDAxJJrBd3MlkhW2mNp0Z7N5vC37FZKpTkqC5nURidsWfyOb +4uNHZiwsVFbW9yvZIqKl4kplrF+P8CTV5H1Lk8ZHFnZpVqt965dwAPZNlZ26EzEITa1 deLxRWigxWFxxoPsU1DKZpY7eFDwlO6WEz1vXw5/lTDwhpZfZsa8vzcwsNdDGmorS+AZ V/RxK8qPjT8NpLBPw28fSssgL0XJNrfJoCBzmwZ94sE7XeEIrsGDcas+nkKgCmyamVMh 0/aDfvF6Rb5LPhLX/xshxGSczTe5MALUH+kX2SX4b3fjmte4SFy0SeqvVg8r0E3FfAKa vbCg== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si11565691ejv.335.2019.11.17.22.58.03; Sun, 17 Nov 2019 22:58:29 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726827AbfKRG4f (ORCPT + 99 others); Mon, 18 Nov 2019 01:56:35 -0500 Received: from mail-lf1-f65.google.com ([209.85.167.65]:38024 "EHLO mail-lf1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726481AbfKRG4e (ORCPT ); Mon, 18 Nov 2019 01:56:34 -0500 Received: by mail-lf1-f65.google.com with SMTP id q28so12858129lfa.5; Sun, 17 Nov 2019 22:56:32 -0800 (PST) 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:in-reply-to:user-agent; bh=ZilPVsgy6B4aFkcKkLwJzf3PfDFkHFr/6jpNuKdup0M=; b=sg9jg1DrYlnEeEKpEsFLcX+7FRt+Dbl1lZZOCw5GORoljULXLYctsOoxRPitqHUB/n ugRE/oubEREoKWTyj0vPgugHgadCecnW6QTZA3CwdixmKb7WwtXzEk4z8cEuok+GeGo5 2sn/ewCmcYexnLJGC4amaNylARx6qGNJsDGqQLu/9USE/V2RAGyDM7a+bOuXE/PoShdo R2L5TK/WN/BBzoiYcUGux+5FR/a4m3ls9YWAihknvP2WoTvw2f0zCoAjzz9rTI8lF1t2 g3JBfnSFP8AogxRPd7uOEoNXERMFKxnB3PyZpDJKdy+L5s7OH4XN2MlEjwg5l3lZL+A9 cp/w== X-Gm-Message-State: APjAAAWt25lqpLZgNNGPLCnhOFH3ApNnVsJNoHdjZmkb7P8DcU/Vngcx GDgZSRUmEL5mCK23RVK3OOY= X-Received: by 2002:a19:f606:: with SMTP id x6mr2745329lfe.160.1574060191676; Sun, 17 Nov 2019 22:56:31 -0800 (PST) Received: from localhost.localdomain ([213.255.186.46]) by smtp.gmail.com with ESMTPSA id p18sm8535547lfh.24.2019.11.17.22.56.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Nov 2019 22:56:31 -0800 (PST) Date: Mon, 18 Nov 2019 08:56:24 +0200 From: Matti Vaittinen To: matti.vaittinen@fi.rohmeurope.com, mazziesaccount@gmail.com Cc: Lee Jones , Jacek Anaszewski , Pavel Machek , Dan Murphy , Rob Herring , Mark Rutland , Liam Girdwood , Mark Brown , Jonathan Corbet , Michael Turquette , Stephen Boyd , Linus Walleij , Bartosz Golaszewski , Alessandro Zummo , Alexandre Belloni , Mauro Carvalho Chehab , Jeff Kirsher , Wolfram Sang , Marek Szyprowski , Heiner Kallweit , Nicholas Mc Guire , Phil Edworthy , linux-leds@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-clk@vger.kernel.org, linux-gpio@vger.kernel.org, linux-rtc@vger.kernel.org Subject: [PATCH v5 06/16] mfd: input: bd71828: Add power-key support Message-ID: <3d9db6ef3de2e851c9e00e1e20aa5bdbf7e2b09c.1574059625.git.matti.vaittinen@fi.rohmeurope.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use gpio_keys to send power input-event to user-space when power button (short) press is detected. Signed-off-by: Matti Vaittinen Acked-for-MFD-by: Lee Jones --- No changes from v4 drivers/mfd/rohm-bd71828.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/mfd/rohm-bd71828.c b/drivers/mfd/rohm-bd71828.c index 7f445d699fd9..b892b50ec555 100644 --- a/drivers/mfd/rohm-bd71828.c +++ b/drivers/mfd/rohm-bd71828.c @@ -4,7 +4,9 @@ // // ROHM BD71828 PMIC driver +#include #include +#include #include #include #include @@ -15,6 +17,18 @@ #include #include +static struct gpio_keys_button button = { + .code = KEY_POWER, + .gpio = -1, + .type = EV_KEY, +}; + +static struct gpio_keys_platform_data bd71828_powerkey_data = { + .buttons = &button, + .nbuttons = 1, + .name = "bd71828-pwrkey", +}; + static const struct resource rtc_irqs[] = { DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC0, "bd71828-rtc-alm-0"), DEFINE_RES_IRQ_NAMED(BD71828_INT_RTC1, "bd71828-rtc-alm-1"), @@ -35,6 +49,10 @@ static struct mfd_cell bd71828_mfd_cells[] = { .name = "bd71828-rtc", .resources = rtc_irqs, .num_resources = ARRAY_SIZE(rtc_irqs), + }, { + .name = "gpio-keys", + .platform_data = &bd71828_powerkey_data, + .pdata_size = sizeof(bd71828_powerkey_data), }, }; @@ -288,6 +306,14 @@ static int bd71828_i2c_probe(struct i2c_client *i2c) dev_dbg(&i2c->dev, "Registered %d IRQs for chip\n", bd71828_irq_chip.num_irqs); + ret = regmap_irq_get_virq(irq_data, BD71828_INT_SHORTPUSH); + if (ret < 0) { + dev_err(&i2c->dev, "Failed to get the power-key IRQ\n"); + return ret; + } + + button.irq = ret; + ret = devm_mfd_add_devices(&i2c->dev, PLATFORM_DEVID_AUTO, bd71828_mfd_cells, ARRAY_SIZE(bd71828_mfd_cells), NULL, 0, -- 2.21.0 -- Matti Vaittinen, Linux device drivers ROHM Semiconductors, Finland SWDC Kiviharjunlenkki 1E 90220 OULU FINLAND ~~~ "I don't think so," said Rene Descartes. Just then he vanished ~~~ Simon says - in Latin please. ~~~ "non cogito me" dixit Rene Descarte, deinde evanescavit ~~~ Thanks to Simon Glass for the translation =]