From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 476D73DD53D for ; Fri, 27 Mar 2026 10:55:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608961; cv=none; b=QOUS/svQeSl2d1l/DQ6KVqBjQL8Wd4S5lwZw2Fwy/k9nhCJRgtCo/dfZUIQFeMuqAUQMr4WbjtWJs9T5++jnQiRIcla39F3nq8JqMKkPB0Xo7dvPmiNoZit4eysTGUupaX7ARPm7AHa+QbXfpVEuz/MWbOxoYbh3PCed4MYlduU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774608961; c=relaxed/simple; bh=JwN+xFU3BdqMHMhrf5fxcPHFC/J8Z3135TdfujykIC4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JUOEcWGEEwh7BjguW6U06djUZu+bVnvcowjnfAclfMiA31VJVWp5r3p3eh29n7yuN/pQjShWOkIWrJTFBIWRC3zB2TsC7dkjXDpA5pEYT/F4El5fVMwr5eXzHPRUM11I3NfI8wwBlCRp4qWNvCEOfHB57UMmiGutIUwTKTXZTRw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ZG8z3WZG; arc=none smtp.client-ip=209.85.167.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ZG8z3WZG" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5a2853b1f8cso1964913e87.3 for ; Fri, 27 Mar 2026 03:55:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1774608957; x=1775213757; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=Jbfnvk2B1X6idPGFAvRnVRmIMmaoLSqJ8OMDnQHYETw=; b=ZG8z3WZGUst60RrbeWhxFZ2JaGPzJWAuUg3wPe6ox8c5/ev1Cs5ijqQdjkFm4kCW6X 7etelvfofP1L5TPnydsD3PHzGEWx//wtSQVMw+Ysjc/cdlqeeyBH+trMnKY66Y7HiMfT 7j1gp6ceI2JaUX3L0st1x0wTkr/27z+sC1IFgxI2V2ySlDTl272wvHbH4DIqF452VCo/ gGPNWHkLOl7RmIxDxrpNwXMRBTlkcMCEOx9NUvD/K9RolBf05nJCxd9Y33ZQniJEMPh6 4/kLLOpWMK/PaFnZMbCkboj/CvVQfP3ZnLqgSs4ZYvS+I8100uSWzDvs/zUlj5nyM/2y k3rw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774608957; x=1775213757; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Jbfnvk2B1X6idPGFAvRnVRmIMmaoLSqJ8OMDnQHYETw=; b=B5MZ1hg/XCM8QCt/GcWsoYVUYs3bBJmQW7W/NscjcsrXj4W3gk3NpWFrbkBHBDbqIW XWifLIiydMfquiRolIfqGM/KqVVv4tLeE9BSDJb84zvJj4YVMOPzXmq7nxEFZeFUh1+R Wr5LxFv/unyKHorzu5uyaJNDn4z83+S7qoIC/kAWpD7u2ETdG5iTWLX0mo64Cbe1lVf0 BNhsOhpHXtvcYMLLDQN32VkQ+q3O2PUY3YcOI89x8pOD3Ehqp17obaZPkUV9DpFFWwLa shv5ZF8+HIuuWgVLoWnfk7F1p5PJ04pO0ohomZT7jk6VIcnJFh5L35euMAMlf1igpfRJ VN8g== X-Gm-Message-State: AOJu0YyEjX/K8/KGnGIds3yHLBKqC0W8x78RyzGucBN+vomgYkqQkTPE 1NToAZBPuFgJ0vyCQq1wPkDb4qKj/FngoFgYyaYqFpcvraoRmLmLhFf0 X-Gm-Gg: ATEYQzw2FYF2k6UatwF5FKirG7HUvZ5f8TD8Mv9VIvqgo2UH7Po9OPgCNd5B9Iz9RA/ eKIrcNEzV/t+Bk7MBGWRQHeSrAzzlsl8kYaOxegxJp6qcQTzaljUFEd/7bKPIR2gph/QOfrFptS 1o357JfwYzSdVX8SxVR1W982MXzOCGQ/n8Y6GxVhAusNRiqr6wk++vDCKcn431wBuLd2KYWmXjx QQNPkoTMnRy3l48L7mI7A2Avhi0lhXgJF0ktx4s2nA6ZEJAAaW7T7rOW1jgwCkcgnoZlECDpan9 NhW1HtlIb2QAhUiB0PxY+F7SkecTMesuBoQqKPEAs1lSw33I+x2+F5q9dWEoeu3xfJlNoS1apgX 7DaynESNy7iTz5jLlE5IdwPjbux/5EvCyMxFz8oVRgXMb9/QWEf03UgCRxMRtLZ/GObLC3QmuGi 15f3szAAI5EwnpW8gxLp06QxhVEWYlRq4v45jPxPCwsSR5rP/Pyb0YlXAYLurMRd+rZZrufL7DB nCY8tWd X-Received: by 2002:a05:6512:3b9f:b0:5a2:a703:971 with SMTP id 2adb3069b0e04-5a2ab5fa141mr834201e87.1.1774608957075; Fri, 27 Mar 2026 03:55:57 -0700 (PDT) Received: from ?IPV6:2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703? ([2a10:a5c0:800d:dd00:8fdf:935a:2c85:d703]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5a2a063dcecsm1270163e87.3.2026.03.27.03.55.55 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 27 Mar 2026 03:55:56 -0700 (PDT) Message-ID: Date: Fri, 27 Mar 2026 12:55:55 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] mfd: rohm-bd718x7: Use software nodes for gpio-keys To: Dmitry Torokhov , Lee Jones Cc: linux-kernel@vger.kernel.org References: <20260324-rohm-software-nodes-v3-0-edde5a0324d5@gmail.com> <20260324-rohm-software-nodes-v3-2-edde5a0324d5@gmail.com> Content-Language: en-US, en-AU, en-GB, en-BW From: Matti Vaittinen In-Reply-To: <20260324-rohm-software-nodes-v3-2-edde5a0324d5@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 25/03/2026 02:54, Dmitry Torokhov wrote: > Refactor the rohm-bd7182x7 MFD driver to use software nodes for > instantiating the gpio-keys child device, replacing the old > platform_data mechanism. > > The power key's properties are now defined using software nodes and > property entries. The IRQ is passed as a resource attached to the > platform device. > > This will allow dropping support for using platform data for configuring > gpio-keys in the future. > > Signed-off-by: Dmitry Torokhov > --- > drivers/mfd/rohm-bd718x7.c | 118 ++++++++++++++++++++++++++++++++------------- > 1 file changed, 85 insertions(+), 33 deletions(-) > > diff --git a/drivers/mfd/rohm-bd718x7.c b/drivers/mfd/rohm-bd718x7.c > index ff714fd4f54d..39961177a17f 100644 > --- a/drivers/mfd/rohm-bd718x7.c > +++ b/drivers/mfd/rohm-bd718x7.c > @@ -7,7 +7,8 @@ > // Datasheet for BD71837MWV available from > // https://www.rohm.com/datasheet/BD71837MWV/bd71837mwv-e > > -#include > +#include > +#include > #include > #include > #include > @@ -15,37 +16,16 @@ > #include > #include > #include > +#include > #include > #include > > -static struct gpio_keys_button button = { > - .code = KEY_POWER, > - .gpio = -1, > - .type = EV_KEY, > -}; > - > -static struct gpio_keys_platform_data bd718xx_powerkey_data = { > - .buttons = &button, > - .nbuttons = 1, > - .name = "bd718xx-pwrkey", > -}; > - > static struct mfd_cell bd71837_mfd_cells[] = { > - { > - .name = "gpio-keys", > - .platform_data = &bd718xx_powerkey_data, > - .pdata_size = sizeof(bd718xx_powerkey_data), > - }, > { .name = "bd71837-clk", }, > { .name = "bd71837-pmic", }, > }; > > static struct mfd_cell bd71847_mfd_cells[] = { > - { > - .name = "gpio-keys", > - .platform_data = &bd718xx_powerkey_data, > - .pdata_size = sizeof(bd718xx_powerkey_data), > - }, > { .name = "bd71847-clk", }, > { .name = "bd71847-pmic", }, > }; > @@ -125,10 +105,84 @@ static int bd718xx_init_press_duration(struct regmap *regmap, > return 0; > } > > +static void bd718xx_i2c_unregister_swnodes(void *data) > +{ > + const struct software_node *nodes = data; > + const struct software_node *node_group[] = { > + &nodes[0], &nodes[1], NULL > + }; > + > + software_node_unregister_node_group(node_group); > +} > + > +static int bd718xx_i2c_register_pwrbutton(struct device *dev, > + struct irq_domain *irq_domain) > +{ > + static const struct property_entry bd718xx_powerkey_parent_props[] = { > + PROPERTY_ENTRY_STRING("label", "bd718xx-pwrkey"), > + { } > + }; > + static const struct property_entry bd718xx_powerkey_props[] = { > + PROPERTY_ENTRY_U32("linux,code", KEY_POWER), > + { } > + }; > + const struct resource res[] = { > + DEFINE_RES_IRQ_NAMED(BD718XX_INT_PWRBTN_S, "bd718xx-pwrkey"), > + }; > + struct mfd_cell gpio_keys_cell = { > + .name = "gpio-keys", > + .resources = res, > + .num_resources = ARRAY_SIZE(res), > + }; > + const struct software_node * const *node_group; > + struct software_node *nodes; > + int error; > + > + nodes = devm_kcalloc(dev, 2, sizeof(*nodes), GFP_KERNEL); > + if (!nodes) > + return -ENOMEM; > + > + /* Node corresponding to gpio-keys device itself */ > + nodes[0].name = devm_kasprintf(dev, GFP_KERNEL, "%s-power-key", dev_name(dev)); > + if (!nodes[0].name) > + return -ENOMEM; > + > + nodes[0].properties = bd718xx_powerkey_parent_props; > + > + /* Node representing power button within gpio-keys device */ > + nodes[1].parent = &nodes[0]; > + nodes[1].properties = bd718xx_powerkey_props; > + > + node_group = (const struct software_node *[]){ > + &nodes[0], > + &nodes[1], > + NULL > + }; Hmm. I suppose I was not explaining myself well. When I asked for a temporary variable, I was hoping to get rid of this syntax. Something like: const struct software_node *node_group[3]; node_group[0] = &nodes[0]; node_group[1] = &nodes[1]; node_group[2] = NULL; would look more familiar to me. Well, I suppose I can live with this if it is Ok to Lee though. Let's see if he has an opinion. Other than this the change looks very good to me! Thanks. Yours, -- Matti -- --- Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~