Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1327275rbb; Mon, 26 Feb 2024 06:08:55 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWvZ7fpNWBmm7qqHOAz6s1sk4QJ9eVjil7ZYIImUFCXsWleSCg4yiABUylr8rgh00uz85/2SHizD01KNyFioo4JPpMsTyGG7NiWAV62nw== X-Google-Smtp-Source: AGHT+IF2EPIFX5EdCYWD2iM9ypomnGTUTBG3MaW12t6E/eFk5A0HEK9ltJqhHmay0f6pi7urE5tf X-Received: by 2002:a05:620a:5697:b0:783:ae0c:5e8f with SMTP id wg23-20020a05620a569700b00783ae0c5e8fmr6644311qkn.71.1708956535021; Mon, 26 Feb 2024 06:08:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708956535; cv=pass; d=google.com; s=arc-20160816; b=BHEFLDipypjr0q1uhL/ev6dwUj7Ug0XqbwLWPjwPi5Gve3+XejKlPJml9vKVi0+9Bv SrT/+l8cWVv5s0qSQRPvlems4vauzTvRnLYLmtUTQqLCG0X1TIqumzAbG4T9k6KwCekz WFy3VLWxzkX5UHsA7AdGxV/dchuvC9mCdtOy5YWv4xUzsIV0IqyhHOL4bJqQ137kQddm LOPLRAaYv3oVSYtL5xo52M8xVFwhGPqlgEPg0Ob7ppOkGrvgefkcmp9ZtTNUlG8lnXMr 2os0eaivOf6IRk2YCeWM4Y2j+57KQKhFkyOLgK61sDnp7abtZSfLbSvcqG+QHwTYgJD+ ymAg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=JVIGrmS6RnT3NTl3t8HBZ21S2Q9+y7Yz6A2Z4wbdOg8=; fh=5HgnQAYqCOWboAWRvakG3ue2T52foY4XuegzwPiQxO8=; b=SNkHH5rq6ZIJb5Sn3Q2ZT5knC12dszuJwytzs4uP5prVX3YxAM4GSraGgWMCO6q+pE oCAsw+aG9+7a5iNedZNm+NyLW5Lk+lU1C+0DfyhiM365uUyOn7imws6uD90wFPOW/8+L Q7W3thv5pNFsV9XXGBiH06LM7CfXTex/TzN8HQAAkuBm978RGLbXSjepU4sGXs8gzZAK M5/a27a0o+VesPuf1GQeIwR2lvtGgmZ+6CZGPLfKMFN8lfd9Sh06wUvOPeo5dYmDWXZk 56/OMg8EU+UC0fF4bzAW0ZP9m3CiPQsXbWTMafmT5VXl2bWl/KaIhQK+cXtxo6AebPxP OBIg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-81576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d25-20020a05620a159900b007875238b58csi5124673qkk.432.2024.02.26.06.08.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 06:08:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-81576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-81576-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-81576-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C41E51C229B7 for ; Mon, 26 Feb 2024 14:08:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BEE7129A96; Mon, 26 Feb 2024 14:04:36 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6C3821292FB; Mon, 26 Feb 2024 14:04:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708956275; cv=none; b=GtN6FOBwhvjDUBJ/4uxEQSTEMSPyZgwYOD8yIcSTrFmzwWqkMT14F11ijikPBmndX7Wb4bnBfIHtdeIAakCzfr04SMliMotA1l1chHQ5gjUTzXwJ3IQ75ZuZdJN0cxAx7tPsTclyE7X+O/B0P9mPg/KjI7URFSnw1YDlB1TqQl4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708956275; c=relaxed/simple; bh=eE9D94MSGkexm4+cS9xd5Yz5/AUzCiXROv8azBoWYqc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=jQUtUXtgFfXrPvZyB/5l4TS44t6nRIM3gfB/APXYzgZ8+eKil7gHWgEfSBs5bfXKPeRRVIiK6h38hmXbuLg35dC55g42sMV1PD27VBBZZKMdZR2ZOIvuCVlJa7+IomxD7L89elmWKX2IC7wBy99vdSOrQfPYwTMT2xtsH8E5x8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 543F5DA7; Mon, 26 Feb 2024 06:05:11 -0800 (PST) Received: from pluto (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DC99E3F762; Mon, 26 Feb 2024 06:04:30 -0800 (PST) Date: Mon, 26 Feb 2024 14:04:28 +0000 From: Cristian Marussi To: "Peng Fan (OSS)" Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Sudeep Holla , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Peng Fan Subject: Re: [PATCH 4/5] firmware: imx: support BBM module Message-ID: References: <20240202-imx95-bbm-misc-v1-0-3cb743020933@nxp.com> <20240202-imx95-bbm-misc-v1-4-3cb743020933@nxp.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240202-imx95-bbm-misc-v1-4-3cb743020933@nxp.com> On Fri, Feb 02, 2024 at 02:34:42PM +0800, Peng Fan (OSS) wrote: > From: Peng Fan > > The BBM module provides RTC and BUTTON feature. To i.MX95, this module > is managed by System Manager. Linux could use i.MX SCMI BBM Extension > protocol to use RTC and BUTTON feature. > > This driver is to use SCMI interface to get/set RTC, enable pwrkey. > Hi some further remarks questin about pwrkey down below. > Signed-off-by: Peng Fan > --- > drivers/firmware/imx/Makefile | 1 + > drivers/firmware/imx/sm-bbm.c | 317 ++++++++++++++++++++++++++++++++++++++++++ > 2 files changed, 318 insertions(+) > [snip] > +static int scmi_imx_bbm_pwrkey_init(struct scmi_device *sdev) > +{ > + const struct scmi_handle *handle = sdev->handle; > + struct device *dev = &sdev->dev; > + struct scmi_imx_bbm *bbnsm = dev_get_drvdata(dev); > + struct input_dev *input; > + int ret; > + > + if (device_property_read_u32(dev, "linux,code", &bbnsm->keycode)) { > + bbnsm->keycode = KEY_POWER; > + dev_warn(dev, "key code is not specified, using default KEY_POWER\n"); > + } This linux,code binding prop is searched in the SCMI device node, BUT your BB< protocol binding does NOT mention it at all. > + > + INIT_DELAYED_WORK(&bbnsm->check_work, scmi_imx_bbm_pwrkey_check_for_events); > + > + input = devm_input_allocate_device(dev); > + if (!input) { > + dev_err(dev, "failed to allocate the input device for SCMI IMX BBM\n"); > + return -ENOMEM; > + } > + > + input->name = dev_name(dev); > + input->phys = "bbnsm-pwrkey/input0"; > + input->id.bustype = BUS_HOST; > + > + input_set_capability(input, EV_KEY, bbnsm->keycode); > + > + ret = devm_add_action_or_reset(dev, scmi_imx_bbm_pwrkey_act, bbnsm); > + if (ret) { > + dev_err(dev, "failed to register remove action\n"); > + return ret; > + } > + > + bbnsm->input = input; > + > + ret = handle->notify_ops->devm_event_notifier_register(sdev, SCMI_PROTOCOL_IMX_BBM, > + SCMI_EVENT_IMX_BBM_BUTTON, > + NULL, &bbnsm->nb); > + > + if (ret) > + dev_err(dev, "Failed to register BBM Button Events %d:", ret); > + > + ret = input_register_device(input); > + if (ret) { > + dev_err(dev, "failed to register input device\n"); > + return ret; > + } > + > + return 0; > +} I suppose you cannot use std SystemPower protocol and scmi_power_control existent upstream driver because you are configuring the event keycode that is associated with your button press event using linux,code DT properies looked up above, right ? (which you need to define somewhere as said above..) I was thinking that maybe handling events associated with generic button-presses could be done via some std SCMI protocols like PINCTRL/GPIO (IF IT HAD NOTIFICATIONS) and some custom SCMI gpio-keys driver in the future (not now clearly :D)...thoughts ? Thanks, Cristian