From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 C2DD6254878; Thu, 17 Apr 2025 18:46:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744915561; cv=none; b=FZU4F4LASOToezpyQ6TZuz+6/EqomfM+6jFWz+oufznj1Wb9PeN41UW/JCl3nDYiljH5JfWMb0V7LXG1cqcV1//YQabyp6aJ5wF/Qi//mnVYhWA+u1jXRQ9G4+rLmcavuboy0nk+XBuvhpTzs2kxl+gBnrpKDEtxB9Z5CpEq5HU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1744915561; c=relaxed/simple; bh=eczCMvPnmS/UB8By0HAn5YaPpyA1a3n5YCs298rEE24=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=hK8NeBxyPbC/3zDA1bfdOGDyb3JPmjv/Qp8qLnGTEn+jZ3f4FyB3LPfr4hzFBMg+lSeubgWx04+NS9Kn9ZCEUpCtghSyZ5kOYR20U3v2qGscfWvB7hYI15GFO3Y+0Eyz+zRIfl0wiQZoK9qCeAG3wRmiZe2WfCVm5fIQyPM5M5c= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=y/oiQ2hj; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="y/oiQ2hj" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54191C4CEE4; Thu, 17 Apr 2025 18:46:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1744915561; bh=eczCMvPnmS/UB8By0HAn5YaPpyA1a3n5YCs298rEE24=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=y/oiQ2hjkYiOqkX7XsE9b62yHNyt6P58wS+H2tmO/8ZEJX1hfphia5B/BCGuCAoQz hQBn9GYEppLzU1EdyAIKP4qzsNdr3qVwdzEo6EVEf1PpU3PBaoE5NPXPs9MqUfqcS8 8b6Ek5BPVOdS5gcFM87JStxJI6vAu6Yh2rlAuhL0= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jules Noirant , =?UTF-8?q?Tomasz=20Paku=C5=82a?= , =?UTF-8?q?Micha=C5=82=20Kope=C4=87?= , Paul Dino Jones , =?UTF-8?q?Crist=C3=B3ferson=20Bueno?= , Pablo Cisneros , Jiri Kosina , Sasha Levin Subject: [PATCH 6.12 167/393] HID: pidff: Stop all effects before enabling actuators Date: Thu, 17 Apr 2025 19:49:36 +0200 Message-ID: <20250417175114.308857692@linuxfoundation.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250417175107.546547190@linuxfoundation.org> References: <20250417175107.546547190@linuxfoundation.org> User-Agent: quilt/0.68 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Tomasz Pakuła [ Upstream commit ce52c0c939fcb568d1abe454821d5623de38b424 ] Some PID compliant devices automatically play effects after boot (i.e. autocenter spring) that prevent the rendering of other effects since it is done outside the kernel driver. This makes sure all the effects currently played are stopped after resetting the device. It brings compatibility to the Brunner CLS-P joystick and others Reported-by: Jules Noirant Signed-off-by: Tomasz Pakuła Reviewed-by: Michał Kopeć Reviewed-by: Paul Dino Jones Tested-by: Paul Dino Jones Tested-by: Cristóferson Bueno Tested-by: Pablo Cisneros Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/usbhid/hid-pidff.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/drivers/hid/usbhid/hid-pidff.c b/drivers/hid/usbhid/hid-pidff.c index 6b55345ce75ac..635596a57c75d 100644 --- a/drivers/hid/usbhid/hid-pidff.c +++ b/drivers/hid/usbhid/hid-pidff.c @@ -109,8 +109,9 @@ static const u8 pidff_pool[] = { 0x80, 0x83, 0xa9 }; /* Special field key tables used to put special field keys into arrays */ #define PID_ENABLE_ACTUATORS 0 -#define PID_RESET 1 -static const u8 pidff_device_control[] = { 0x97, 0x9a }; +#define PID_STOP_ALL_EFFECTS 1 +#define PID_RESET 2 +static const u8 pidff_device_control[] = { 0x97, 0x99, 0x9a }; #define PID_CONSTANT 0 #define PID_RAMP 1 @@ -1235,6 +1236,10 @@ static void pidff_reset(struct pidff_device *pidff) hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); hid_hw_wait(hid); + pidff->device_control->value[0] = pidff->control_id[PID_STOP_ALL_EFFECTS]; + hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); + hid_hw_wait(hid); + pidff->device_control->value[0] = pidff->control_id[PID_ENABLE_ACTUATORS]; hid_hw_request(hid, pidff->reports[PID_DEVICE_CONTROL], HID_REQ_SET_REPORT); -- 2.39.5