Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp6593525rdb; Tue, 2 Jan 2024 07:02:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IF7yBRc2HyQw23KeSAxm4zH6La7wsNcUqVAbeOM5STDJzkhR76448U4ZHK6Qyj4/olXJugx X-Received: by 2002:a05:6808:21a6:b0:3b9:fae1:82b4 with SMTP id be38-20020a05680821a600b003b9fae182b4mr21124055oib.68.1704207767474; Tue, 02 Jan 2024 07:02:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704207767; cv=none; d=google.com; s=arc-20160816; b=k9AGhJDbHzUA3AbzY9PqGSVqN7i8It9Jfnga8OlehBS8b9HfaNl1yWFBal3nliEeW3 k/8xy4py7jg4ICd9wOKl4UQnQbupYieungyAx/FDyaOEevCxOS2aykwxI+IZSsbr4dZg JdygqI8s2g5sLKvgRcLK5T116ViMieb27KFWxePWxtsolpzNU3ViFxSZuxFU4hUfVypX n1csjL6EDMPOi+TwP1nEFBktqWmHkqnosi1cO1q762CKviPgCbnd3ufbAr4OaSjVmPKf +Ggk8BrWso0+XgRO9SO179t+z/BeddE0CwNzsdXQ2z1Hk2cDcRICU1OIBmdOZ4OW/fqK qshw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=wV54aLCafCqPFkfP1HXduuwoFpHJPYhvba9jOLf4nBI=; fh=oJg4cWaGBAcptmyVj4qtGvaoXzEBwzWhdCPjuel4sSs=; b=GEPq96Y7pw4W02N9lL0/ij4vs3xQ01dlU7vrk2QaBirZPt4JhpS8O6iigQOHbDv4oi yT0DFxYLcCO1uPfonJuF7nlvbFyyUO3EaBQwToxWzJ8WKXVW87MqPvcCeNyE4/zHmfiE t8pdY1p9uBXZvAWGQIlfQgGaB/adDivOAPhZ/eukX5mkAlGNhvnaMOJTWo6RVfnm9+3g jN49f9TK9MitUs/IL4jJfSSaOaFnTsURN+3cCE0HOAfBqxBn3NNlAFnK47z51dew4QUV R7w4SC7rgZsRPdZk2DcYgODjUKtEydDOMuXjYCpwghIO0+bikqL24vyDjo64DttECuUH RQCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WaTnIwQo; spf=pass (google.com: domain of linux-kernel+bounces-14522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id m2-20020a67bb02000000b00467061251d8si1497813vsn.802.2024.01.02.07.02.47 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jan 2024 07:02:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-14522-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; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=WaTnIwQo; spf=pass (google.com: domain of linux-kernel+bounces-14522-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-14522-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.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 345E61C223AF for ; Tue, 2 Jan 2024 15:02:47 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AFE6014F6C; Tue, 2 Jan 2024 15:02:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cirrus.com header.i=@cirrus.com header.b="WaTnIwQo" X-Original-To: linux-kernel@vger.kernel.org Received: from mx0b-001ae601.pphosted.com (mx0a-001ae601.pphosted.com [67.231.149.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 603B914A9C; Tue, 2 Jan 2024 15:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=opensource.cirrus.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=opensource.cirrus.com Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 4029fW3Z029874; Tue, 2 Jan 2024 08:57:35 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h= from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding:content-type; s=PODMain02222019; bh=w V54aLCafCqPFkfP1HXduuwoFpHJPYhvba9jOLf4nBI=; b=WaTnIwQoKiFd8jS9F BiwUsHA7xT9lyGjhVrolWlrQmi8olx1hpmno9tXJkXDgUwvYaLqM9xkXRVSMvkUO Wj8k0bidYuPBaetoPZk0nYeu67J+4HoRgFKsAr4ciMOHyL8hQBlybiAqkPS5yKHT Wfe8RITDuqfsMY8GfuXhL4btTSsdURSQ4Lhe4tE+1tlCdbcOA18b96ljOU+IFoHu kuEiwV4/GTMoe7p3sK02AFdOr0zN4o0nDQ8r/aTowyrsynZ5g4FQ01t6pYAIxqW+ szo+aUraiUVv6HBmGWNxkrNCWVLyT2ldLj08BniEhbhckBqbJuUNSivL/Arltv0Z 5Dd5g== Received: from ediex02.ad.cirrus.com ([84.19.233.68]) by mx0a-001ae601.pphosted.com (PPS) with ESMTPS id 3vahg2b9t3-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 02 Jan 2024 08:57:35 -0600 (CST) Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex02.ad.cirrus.com (198.61.84.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.40; Tue, 2 Jan 2024 14:57:33 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.40 via Frontend Transport; Tue, 2 Jan 2024 14:57:33 +0000 Received: from aus-sw-rshr002.ad.cirrus.com (aus-sw-rshr002.ad.cirrus.com [141.131.145.53]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 6907A46B; Tue, 2 Jan 2024 14:57:32 +0000 (UTC) From: James Ogletree To: CC: James Ogletree , Jeff LaBundy , Dmitry Torokhov , Jonathan Corbet , "open list:INPUT (KEYBOARD, MOUSE, JOYSTICK, TOUCHSCREEN)..." , "open list:DOCUMENTATION" , open list Subject: [PATCH RESEND 1/2] Input: support pre-stored effects Date: Tue, 2 Jan 2024 14:56:12 +0000 Message-ID: <20240102145614.127736-1-jogletre@opensource.cirrus.com> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: mJkb45CEN7JXr_gPI6I5WKL9bsgKZ5SL X-Proofpoint-ORIG-GUID: mJkb45CEN7JXr_gPI6I5WKL9bsgKZ5SL X-Proofpoint-Spam-Reason: safe At present, the best way to define effects that pre-exist in device memory is by utilizing the custom_data field of ff_periodic_effect, which it was not intended for, and which requires extra processing by the driver. Provide simpler option for interacting with pre-stored effects in device memory. Reviewed-by: Jeff LaBundy Signed-off-by: James Ogletree --- include/uapi/linux/input.h | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/include/uapi/linux/input.h b/include/uapi/linux/input.h index 2557eb7b0561..689e5fa10647 100644 --- a/include/uapi/linux/input.h +++ b/include/uapi/linux/input.h @@ -428,17 +428,27 @@ struct ff_rumble_effect { __u16 weak_magnitude; }; +/** + * struct ff_prestored_effect - defines parameters of a pre-stored force-feedback effect + * @index: index of effect + * @bank: memory bank of effect + */ +struct ff_prestored_effect { + __u16 index; + __u16 bank; +}; + /** * struct ff_effect - defines force feedback effect * @type: type of the effect (FF_CONSTANT, FF_PERIODIC, FF_RAMP, FF_SPRING, - * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, or FF_CUSTOM) + * FF_FRICTION, FF_DAMPER, FF_RUMBLE, FF_INERTIA, FF_PRESTORED, or FF_CUSTOM) * @id: an unique id assigned to an effect * @direction: direction of the effect * @trigger: trigger conditions (struct ff_trigger) * @replay: scheduling of the effect (struct ff_replay) * @u: effect-specific structure (one of ff_constant_effect, ff_ramp_effect, - * ff_periodic_effect, ff_condition_effect, ff_rumble_effect) further - * defining effect parameters + * ff_periodic_effect, ff_condition_effect, ff_rumble_effect, ff_prestored_effect) + * further defining effect parameters * * This structure is sent through ioctl from the application to the driver. * To create a new effect application should set its @id to -1; the kernel @@ -464,6 +474,7 @@ struct ff_effect { struct ff_periodic_effect periodic; struct ff_condition_effect condition[2]; /* One for each axis */ struct ff_rumble_effect rumble; + struct ff_prestored_effect prestored; } u; }; @@ -479,20 +490,21 @@ struct ff_effect { #define FF_DAMPER 0x55 #define FF_INERTIA 0x56 #define FF_RAMP 0x57 +#define FF_PRESTORED 0x58 #define FF_EFFECT_MIN FF_RUMBLE -#define FF_EFFECT_MAX FF_RAMP +#define FF_EFFECT_MAX FF_PRESTORED /* * Force feedback periodic effect types */ -#define FF_SQUARE 0x58 -#define FF_TRIANGLE 0x59 -#define FF_SINE 0x5a -#define FF_SAW_UP 0x5b -#define FF_SAW_DOWN 0x5c -#define FF_CUSTOM 0x5d +#define FF_SQUARE 0x59 +#define FF_TRIANGLE 0x5a +#define FF_SINE 0x5b +#define FF_SAW_UP 0x5c +#define FF_SAW_DOWN 0x5d +#define FF_CUSTOM 0x5e #define FF_WAVEFORM_MIN FF_SQUARE #define FF_WAVEFORM_MAX FF_CUSTOM -- 2.25.1