Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6775779pxb; Wed, 17 Feb 2021 13:08:01 -0800 (PST) X-Google-Smtp-Source: ABdhPJz7arSW33H2CwyGBm3Am4cEqELWxVhTo5g0JN8qM3bdlIg3wlOJURXyIOrtu/co5ONO/lSJ X-Received: by 2002:aa7:db0e:: with SMTP id t14mr703442eds.29.1613596081553; Wed, 17 Feb 2021 13:08:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613596081; cv=none; d=google.com; s=arc-20160816; b=EOeBfJHlsYggTo/J2lPTilQzX8x6p0E9GyYX8/f5mXUADPap4Si7zeVdWWuKZgteOJ oECzwWnYGOrgCFaFZdMVi/qUKC4nQYwJLqFXqA8tKvT5f1m/gj6wUs1/csLL4OWOBcV4 tFfvm1MRt44xQ85fMQiBO7kj1E7eTQy1eJF3rOF+y3iekaM+vx9dyqXzy/LYEl34nJYa Luxc5dTAWm8isfuGzLBLKg+e2DJDkZmHDhG1FGe/Q9DSCCQlQjv2eK5JXf79cstt0Ddg w4UcIw98rVJrZHzrtnLQvKX7dZxVMreYSoa/wBybdEDn7ESGk5C5Lh5M/S2fNmq+4RZw z0KA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:dkim-signature :dkim-filter:from; bh=NTnBPdcPQ1mHAuBRtKTt9xZ5SgKJhiroAKknFH1WnTw=; b=xiIw2rEJ2Qit/a2/ZimnqTi+X1TX7pIeV6NNST4Iw69y6LEhP1NeWNIRIps0gWIQoj jV6oxGCX/swWZy10wbFzIvSndR5fj9LIGaqerlihs7uJr+ctoWIdasu5H7gY1Xg3VrEo OrN047DbTlLZtQJHipi2EESmFnbLi5unHC0Gv7cEHdQKKWCX7sUDn6VZ48CpjcSp84CK Owf7xZAwbVjUb6+gpFZjszx/5qz9Dmm0LvxEoIrawMvyW4fa1nelTU9cBQOl3plfgSL2 S0AxfA3SUavXvaufsvqFe8DuAPvSKpPwJwE8wG/rAVVsoYSHr2gtXMD5sTmDTDi6w4fj 9W8w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@innovation.ch header.s=default header.b=bjhz7O0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=innovation.ch Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b8si802270ejq.235.2021.02.17.13.07.37; Wed, 17 Feb 2021 13:08:01 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@innovation.ch header.s=default header.b=bjhz7O0G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=innovation.ch Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232419AbhBQTTO (ORCPT + 99 others); Wed, 17 Feb 2021 14:19:14 -0500 Received: from ec2-44-228-98-151.us-west-2.compute.amazonaws.com ([44.228.98.151]:58878 "EHLO chill.innovation.ch" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S232547AbhBQTTN (ORCPT ); Wed, 17 Feb 2021 14:19:13 -0500 X-Greylist: delayed 651 seconds by postgrey-1.27 at vger.kernel.org; Wed, 17 Feb 2021 14:19:10 EST Received: from localhost (localhost [127.0.0.1]) by chill.innovation.ch (Postfix) with ESMTP id 30D451B640F; Wed, 17 Feb 2021 19:07:32 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at chill.innovation.ch Received: from chill.innovation.ch ([127.0.0.1]) by localhost (chill.innovation.ch [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 7BxdjnFa6Gfu; Wed, 17 Feb 2021 19:07:31 +0000 (UTC) From: =?UTF-8?q?Ronald=20Tschal=C3=A4r?= DKIM-Filter: OpenDKIM Filter v2.11.0 chill.innovation.ch 77B491B5EA9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=innovation.ch; s=default; t=1613588851; bh=NTnBPdcPQ1mHAuBRtKTt9xZ5SgKJhiroAKknFH1WnTw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bjhz7O0GLjLTNOkGgBYYRnp9CBqiOsET9xfFY56qDsSxdHc7lpTIB8Nj5s8g0RGiX 4cJVGHvCZEkrfhaBvjueFaVDAUkMpdFoJVy+Ja9LoShKKssBoRdTneci9h3uTS/MIs NzrN6crorswasrDXGxzyydNVitahKYpClQ94koL7C9R554dJ38Y24OL87PrDWrci3S St0BCcJNP4kf06+0CipaFtNK2VwQ/kDrHG4g+v6UuA/cdT5eBqXFWlJd60NmbUk75+ ecC4d/6YGdC+ieNIb8JW15fcHsEpG+1NTvFW7NfbYc63ZIJkUVDiGlabMqH9Y52S2c wR4lmGJm+vm/g== To: Dmitry Torokhov Cc: "Gustavo A. R. Silva" , Sergiu Cuciurean , Lee Jones , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] Input: applespi: Add trace_event module param for early tracing. Date: Wed, 17 Feb 2021 11:07:18 -0800 Message-Id: <20210217190718.11035-3-ronald@innovation.ch> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210217190718.11035-1-ronald@innovation.ch> References: <20210217190718.11035-1-ronald@innovation.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The problem is that tracing can't be set via sysfs until the module is loaded, at which point the keyboard and trackpad initialization commands have already been run and hence tracing can't be used to debug problems here. Adding this param allows tracing to be enabled for messages sent and received during module probing. It takes comma-separated list of events, e.g. trace_event=applespi_tp_ini_cmd,applespi_bad_crc Signed-off-by: Ronald Tschalär --- drivers/input/keyboard/applespi.c | 32 +++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/drivers/input/keyboard/applespi.c b/drivers/input/keyboard/applespi.c index f0a0067c48ff6..03f9ad0f83967 100644 --- a/drivers/input/keyboard/applespi.c +++ b/drivers/input/keyboard/applespi.c @@ -53,6 +53,8 @@ #include #include #include +#include +#include #include #include @@ -110,6 +112,10 @@ module_param_string(touchpad_dimensions, touchpad_dimensions, sizeof(touchpad_dimensions), 0444); MODULE_PARM_DESC(touchpad_dimensions, "The pixel dimensions of the touchpad, as XxY+W+H ."); +static char *trace_event; +module_param(trace_event, charp, 0444); +MODULE_PARM_DESC(trace_event, "Enable early event tracing. It takes the form of a comma-separated list of events to enable."); + /** * struct keyboard_protocol - keyboard message. * message.type = 0x0110, message.length = 0x000a @@ -1645,6 +1651,30 @@ static void applespi_save_bl_level(struct applespi_data *applespi, "Error saving backlight level to EFI vars: %d\n", sts); } +static void applespi_enable_early_event_tracing(struct device *dev) +{ + char *buf, *event; + int sts; + + if (trace_event && trace_event[0]) { + buf = kstrdup(trace_event, GFP_KERNEL); + if (!buf) + return; + + while ((event = strsep(&buf, ","))) { + if (event[0]) { + sts = trace_set_clr_event("applespi", event, 1); + if (sts) + dev_warn(dev, + "Error setting trace event '%s': %d\n", + event, sts); + } + } + + kfree(buf); + } +} + static int applespi_probe(struct spi_device *spi) { struct applespi_data *applespi; @@ -1653,6 +1683,8 @@ static int applespi_probe(struct spi_device *spi) int sts, i; unsigned long long gpe, usb_status; + applespi_enable_early_event_tracing(&spi->dev); + /* check if the USB interface is present and enabled already */ acpi_sts = acpi_evaluate_integer(spi_handle, "UIST", NULL, &usb_status); if (ACPI_SUCCESS(acpi_sts) && usb_status) { -- 2.26.2