From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-dy1-f182.google.com (mail-dy1-f182.google.com [74.125.82.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87D6C3C2774 for ; Tue, 16 Jun 2026 04:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.182 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781583383; cv=none; b=NlXK9A3CpkbLVuQmv4l/ONc3H/uMryF1ZEpCvsjQKau4DEv9doIOkjh3sp4zqqaXzv4BkIoL6Godf4xySSd2BUTxYYITPO268zGZfnucdccoTMEkmjQzf2gAw0qlcVblWHOwYaBu+ZBs52uDE3Smj1OHIgyiEbhK63NMJD+R7wg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781583383; c=relaxed/simple; bh=zgVrxfsr6Lw9AkBCvthWB97K2H45BrWBfyjksXlWRGQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=F88vzn4hAPxTw28s72MYXheowELkMmquPB4MT06TgghpxK20PiMUXmDCOgRKU+fWcChSHmOFH7DBmAVD1Ob/qLP61XK+2tCyPsfHGZIsfFs/e7BfM0BeqXtBXn/lZX2MTD9jVuHcbmCVaumH7xaltZlfRL3K369vSAhV9mRZLG0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Kll33fkt; arc=none smtp.client-ip=74.125.82.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Kll33fkt" Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-3078e0dcd67so4370498eec.0 for ; Mon, 15 Jun 2026 21:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1781583382; x=1782188182; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=3em1q6OKNvAsDlZXNz19YR3IMd5ID+hx5lZcJKwh4oM=; b=Kll33fkt6DZGXMD9oJKUbHx4vMJB+MzjVDq9MDkmEw3dNgG4mzHo0RZthjTLI/0koq M5+e0RZo7PqYOxNA0XOaArM72CS24LFDt6FMGt9yF6kVfjS27WM5QpZ52Y2K4Uic1vOZ xQ8mO257g0Glvmd03lHNI+ybYzVVpgBLIkgaYs3DZ4N/HSKsGnt1p4c/bHDyX5ULp24Y caAUhxJyeRxNN4BHTyRtMqSEgTvfpBvbFOarZTD2GacMWP1Hk26SRMbeZSnrVyRzZCS0 cZZocOiSIrU4QjppyNKD+g7S755iWUvHiwP3WyVFjz/jNN43EeL1ATf3DU3UGpkyhKCU tcUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781583382; x=1782188182; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=3em1q6OKNvAsDlZXNz19YR3IMd5ID+hx5lZcJKwh4oM=; b=dsKY+yxJ7BbcwGpCLGy24i3R8DHxeteduYslrzBT0VcBHYcvhX07onDrqebMbiIcr3 U2ErPrPJX2r2d+KblD6QYLBWQiuajDM6AKqRrBwtCk/xxXHw0rsCe9tT0uKEoJ0nDo7v tc3zFvmPCawnV0rSx/y5+X/hJ8iLgCaqGmi7T+iAXR0j2BNCqiHtRr1wvj+c/NcIK2sT dU2Z3/b97Z+sZ3sMC/iGIY1zFAXXDkf9wsnChXWkM6nxXbH+3hExRE4URiRtNXl8q3Cy gI1ma/HW3bvtpEfBI2d0qKUJtwv4NL2ezJQIxMEAjUU2KOIOCjn07CoknBOzZ+F53S+2 vmIA== X-Forwarded-Encrypted: i=1; AFNElJ+orzvuSWPTHKxeLNAOCoCSx57tcJqgOZjxq85x/ekU3ifmaBIlAtYt1DDgwDoeeANw5DpD30U6SWLAPzY=@vger.kernel.org X-Gm-Message-State: AOJu0Yz+SZ2djF/LBnveJK18OAhLWr7W1O8oZm1SnHdcnmlypp7/ty2r ynzWDXtD2J5PPIHpGDX4GCrPEkNs3wfOAssSeN7F3JwvVdNpVWmMmtkj X-Gm-Gg: Acq92OFmTIuGQJ2kbwFQKHzVp0ux39i7lqgYt9TBvVUOpCR8Pm0vu/G8suJ1fBe9/gg WggPUvQbMLuNKlSvxxaNBuethwnloAy+i/LO+0jp+QiDp4BZWcIQXbEuAW6vNxcnioyaIbJJN53 XLtU9U/r87GieqfB2vzVbaGL/1b7Ky1cVcg0PJhsSs6tDl3Gxl4xsGGpTL1BNoZCOWgXqIbPUXQ r3ycHiQ9OIfT6eMWSy75DH4V2Vj9vJCbLbckv2vfNVLXT2D4G9YQoLeR2AZZ0a+WdAq0MTfKAeM 2bvrcHYyC06sRW+p5CHV0ILEEyCuIZctxYJyc81lLk9antwgjzZ7WP2LRY22PiAVWrBrWKzxED0 zS0YV9g8RvZ7aeDGxoe/GtFzpH6naaNkk/NvSkBZYpwyj2LPXYCgB9TxWGSEOJtKTUCA1mJP4cn IqBi9krjbh6L9q2QgAh3frTIaTLlvE0ZsLO76SJ2WYQHIGMwwcKxaFTgsgkCGEFKky X-Received: by 2002:a05:7300:730c:b0:2ea:4228:ab11 with SMTP id 5a478bee46e88-30935239ec2mr7746477eec.3.1781583381482; Mon, 15 Jun 2026 21:16:21 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:3714:f5c2:9b83:3df1]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3081e92096esm17817625eec.15.2026.06.15.21.16.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jun 2026 21:16:20 -0700 (PDT) Date: Mon, 15 Jun 2026 21:16:17 -0700 From: Dmitry Torokhov To: Svyatoslav Ryhel Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Rob Herring , Krzysztof Kozlowski , Conor Dooley , Linus Walleij Subject: Re: [PATCH v5 2/2] Input: isa1200 - new driver for Imagis ISA1200 Message-ID: References: <20260512102445.55372-1-clamor95@gmail.com> <20260512102445.55372-3-clamor95@gmail.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=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Hi Svyatoslav, On Mon, Jun 15, 2026 at 09:19:27AM +0300, Svyatoslav Ryhel wrote: > чт, 28 трав. 2026 р. о 08:38 Svyatoslav Ryhel пише: > > > > вт, 12 трав. 2026 р. о 13:24 Svyatoslav Ryhel пише: > > > > > > From: Linus Walleij > > > > > > The ISA1200 is a haptic feedback unit from Imagis Technology using two > > > motors for haptic feedback in mobile phones. Used in many mobile devices > > > c. 2012 including Samsung Galxy S Advance GT-I9070 (Janice), Samsung Beam > > > GT-I8350 (Gavini), LG Optimus 4X P880 and LG Optimus Vu P895. > > > > > > The exact datasheet for the ISA1200 is not available; all data was modeled > > > based on available downstream kernel sources for various devices and > > > fragments of information scattered across the internet. > > > > > > Tested-by: Linus Walleij # GT-I9070 Janice > > > Signed-off-by: Linus Walleij > > > Co-developed-by: Svyatoslav Ryhel > > > Signed-off-by: Svyatoslav Ryhel > > > --- > > > drivers/input/misc/Kconfig | 12 + > > > drivers/input/misc/Makefile | 1 + > > > drivers/input/misc/isa1200.c | 524 +++++++++++++++++++++++++++++++++++ > > > 3 files changed, 537 insertions(+) > > > create mode 100644 drivers/input/misc/isa1200.c > > > > > > > Hello Dmitry! Do I need to make any further adjustments to this driver? > > Hello Dmitry! Do I need to make any further adjustments to this > driver? This driver is hanging in LKML for some time already without > responds from input maintainer. It is still relevant and I would like > it to move forward. There were valid sashiko comments on the patch regarding resetting "level" to 0 and also potential racing conditions, as well as suggestion to check number of gpios specified in the device tree. Please see if the following works for you: diff --git a/drivers/input/misc/isa1200.c b/drivers/input/misc/isa1200.c index ff82252a08e1..c61adc4b605c 100644 --- a/drivers/input/misc/isa1200.c +++ b/drivers/input/misc/isa1200.c @@ -131,6 +131,7 @@ struct isa1200 { struct work_struct play_work; struct isa1200_config config; + bool suspended; bool active; int level; }; @@ -247,17 +248,21 @@ static void isa1200_stop(struct isa1200 *isa) isa->supplies); isa->active = false; - isa->level = 0; } static void isa1200_play_work(struct work_struct *work) { struct isa1200 *isa = container_of(work, struct isa1200, play_work); - - if (isa->level) - isa1200_start(isa); - else - isa1200_stop(isa); + struct input_dev *input = isa->input; + + scoped_guard(mutex_try, &input->mutex) { + if (!isa->suspended) { + if (isa->level) + isa1200_start(isa); + else + isa1200_stop(isa); + } + } } static int isa1200_vibrator_play_effect(struct input_dev *input, void *data, @@ -280,7 +285,8 @@ static int isa1200_vibrator_play_effect(struct input_dev *input, void *data, if (isa->level != level) { isa->level = level; - schedule_work(&isa->play_work); + if (!READ_ONCE(isa->suspended)) + schedule_work(&isa->play_work); } return 0; @@ -292,6 +298,7 @@ static void isa1200_vibrator_close(struct input_dev *input) cancel_work_sync(&isa->play_work); isa1200_stop(isa); + isa->level = 0; } static int isa1200_of_probe(struct i2c_client *client) @@ -331,6 +338,9 @@ static int isa1200_of_probe(struct i2c_client *client) return dev_err_probe(dev, PTR_ERR(isa->enable_gpios), "failed to get enable gpios\n"); + if (isa->enable_gpios && isa->enable_gpios->ndescs > ISA1200_EN_PINS_MAX) + return dev_err_probe(dev, -EINVAL, "too many enable gpios\n"); + ldo_node = device_get_named_child_node(dev, "ldo"); if (!ldo_node) return dev_err_probe(dev, -ENODEV, @@ -479,9 +489,9 @@ static int isa1200_suspend(struct device *dev) guard(mutex)(&isa->input->mutex); if (input_device_enabled(isa->input)) { + WRITE_ONCE(isa->suspended, true); cancel_work_sync(&isa->play_work); - if (isa->level) - isa1200_stop(isa); + isa1200_stop(isa); } return 0; @@ -493,9 +503,11 @@ static int isa1200_resume(struct device *dev) guard(mutex)(&isa->input->mutex); - if (input_device_enabled(isa->input)) + if (input_device_enabled(isa->input)) { + WRITE_ONCE(isa->suspended, false); if (isa->level) - isa1200_start(isa); + schedule_work(&isa->play_work); + } return 0; } -- Dmitry