From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7AFA2C48BF6 for ; Mon, 26 Feb 2024 14:09:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=KmHEy11HqvHcoegZgTpmYvuXxY6wnOgtSKq/NxIvIY8=; b=UPXAwIBp9vJjVJ Ns0APWlxlHZ0OdvGizYq5BFaVnVh/nfnoqhj4UTgnx6rwHk207BSLcf5hTnuWSC5i7IsQDjCkis92 kUapTUk20HchDUj6CMQPV2kwcFTHTNmPwHzW2wHHyNMMJA1nDgUcUwT0xu2VlJzlC2YsMScuaLSeX 9QztMo+B/HOL1Py7UFryVOSJMZYppLuX4J7DC8egRGHiZFDr02wPYA65iRlEqAGmtaXI1boq8jieZ FVvppiPT5dc04wbDqinfftu+kBL5TbRe+oqyqd6D/AaAClNH50ODJGNXOPscIyz7+Srux0XCqAnHK +t1/Mt86uOpC5XVCCBkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rebfD-000000011su-3Hff; Mon, 26 Feb 2024 14:09:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rebas-00000000zbD-2maq for linux-arm-kernel@lists.infradead.org; Mon, 26 Feb 2024 14:04:39 +0000 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> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240202-imx95-bbm-misc-v1-4-3cb743020933@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240226_060434_952815_C3670298 X-CRM114-Status: GOOD ( 20.87 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel