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 0C97632470E for ; Thu, 7 May 2026 17:00:46 +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=1778173248; cv=none; b=Cgkrjik3/LrE+bMSC/ztVjm5dmWQt/ARoPq4c65VWYgeJuJFaHckOwY6/pRS/iC+3kGjDwfEzf5GK5EBE0MFW/MehkzTwQcK4v2iXUp3llH8YROjn+9eafwe3tKpyP/EIMatKrtFxrtfKaVRQta1frCdxYRW11ym9ZQEWTtsuMY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778173248; c=relaxed/simple; bh=1MY0S1NrSLlFDa5YncGRvWO886u0CmCXtc+ubK184a4=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=eguAt8QTrApvDpXV/b7DBV50z7Ykq6kAdCKmDMEofq8xtK0eBRdLZmXz1ItUhwjQzV0xvHqoggaH8rpuXqVFpfK2uG6kX950tcRtu+CoMTkfHt5wHzRxj/UwOu4Z1ye4va7P/i20I+JA3w419NQyx4iE+bVyRgJVZYnDjS5bOSw= 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=KX6y4fyq; 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="KX6y4fyq" Received: by mail-dy1-f182.google.com with SMTP id 5a478bee46e88-2ee1054627bso1771835eec.1 for ; Thu, 07 May 2026 10:00:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1778173246; x=1778778046; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=q/aYnHghjmowXqI8WvBgOLTVpcMJSrTJbA0f1MMN/YE=; b=KX6y4fyqfKkHyQc6K7ULhpWbbVfPJhJlxv6uPVaQ8hT1h2mYzcH8oT9XN+tbtWotx2 f0X/fH95iXPKFwQDnOUHTYNtoT4+2TToD6i+ubDCMdjI3RvRjayaHWjDjAt4e9d7FUpM E4abof6w/KGpVOsetQWvClOr1OOrEujWW50afAi5Ly3v3XhitYcv7oFR7VWzM3MEmFPd rj7EKFNJG9bybbKbqiQugMkSTkxEN3f2JI7nhbxtN4TCM9c7OQ1UZoQRhxO/fXMXtTqR /0QvXB3rzP+urjYRT6OtA2MeZtS4Q/aL30+2K+V/B3VAliW9qeA+28jOMKt/3eYauGf5 g+FA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778173246; x=1778778046; h=in-reply-to: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=q/aYnHghjmowXqI8WvBgOLTVpcMJSrTJbA0f1MMN/YE=; b=lcDxF1EXTpYnDWUfNzvPgwfYfDqdmbRcOvkOScGCduiOq31phMm0looF8K8w85hGJB NzksklgDKYsIY69WHlqtbTxtgP7id+OIwjKAMdJhZjZPacbDUageCWQ+oQubq9L03COU h7dE1LGwsSIECUPo8Ollrmx2i0wUzFk5W5Lh/F+OSfWFoZhUVkDjOzdyhC6YzK6Q5jyo +xp3Ez9Q99eLo+wMRiwS9JoPmhCh7CsNiq8fX6NIQZjQnDOHzi78NnkTVgQ4hCHvUG7a ix1JNORqVr9IucHGwfJozDwaHrEGSLBwuj96P2IdLLhjWsvE5YqDRhxihQ+iF8L2detT yIAQ== X-Forwarded-Encrypted: i=1; AFNElJ/v1ypAHEGdDYRxxc6aJtSoEuBZ592qO0p7K6ijZXNNtvXRJTzBuRin8Gt4xeutbNTn1lPJCmt/BahF0JE=@vger.kernel.org X-Gm-Message-State: AOJu0YwBLXaCwq1brTBe4HS6Ms/FMfzIh0LVnBBRbFV6VNW1gb9HACwH lQVSo0hf2D/pct2ywLcI5l0an8/aOylII8EKFN0IPNVLIAp2WiJW/dAzdqDEuQ== X-Gm-Gg: AeBDiet8mcNiUn19F2VgATzvepht/VwBMw/hOQlMyV5RVCwpT60s5wNOp/I+hD4bf0c gHeFtROjrT5sjZLyTVU81wJYJCjitADIi9w5lA55k7KJzvkSbksh+eF36QaqsmaOt+puTSc3iYh sCG55i8+IVrgnikpkGxyDHLaqWmcaO0hyjYUrYQH1Ch9Jx1/jVwfjAFxf0unaIRGo3n1ITUsfIY al34o0IUL/E4eI15lltwQ17yir6Lrv0Enl4z2ciaRkywGM/C4/ydDXYNZZp6e1475NnPNcQvHcA /8tbfRpCs9di5XinkCA4XT2igtt1tbiB1Oh64vVa7YpJpu5uT2Uz545FEkzFyIZ8msdzJsLc7ut rlJSMG1ASUhEKI6OfEi1NDirlE2F1BE2sCU/gkrFoUBHakNYW9fXVMNOpi/bYlzL44D1hLxsOFV /O+SyIfgoPE5c8mpR9ZEG8UfH9mCDxzmm6wx8WEGSD0FLzeMk4DKwLzMw3Ie429hwbcsLmlc4Lp fU= X-Received: by 2002:a05:7300:148c:b0:2c1:67e1:61a9 with SMTP id 5a478bee46e88-2f6e4374892mr1554113eec.13.1778173245923; Thu, 07 May 2026 10:00:45 -0700 (PDT) Received: from google.com ([2a00:79e0:2ebe:8:6a50:9473:7750:56ef]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-2f56cec58efsm8840117eec.2.2026.05.07.10.00.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 May 2026 10:00:45 -0700 (PDT) Date: Thu, 7 May 2026 10:00:42 -0700 From: Dmitry Torokhov To: Kris Bahnsen , Marek Vasut Cc: stable@vger.kernel.org, Mark Featherston , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v4] Input: ads7846 - don't use scratch for tx_buf when clearing register Message-ID: References: <20260507164943.760009-1-kris@embeddedTS.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=us-ascii Content-Disposition: inline In-Reply-To: <20260507164943.760009-1-kris@embeddedTS.com> On Thu, May 07, 2026 at 04:49:43PM +0000, Kris Bahnsen wrote: > The workaround for XPT2046 clears the command register, giving the > touchscreen controller a NOP. The change incorrectly re-uses the > req->scratch variable which is used as rx_buf for xfer[5], so by > the time xfer[6] occurs, the contents of req->scratch may not be > 0. It was found that the touchscreen controller can end up in > a completely unresponsive state due to it being given a command > the driver does not expect. > > Instead, rely on the spi_transfer behavior of tx_buf being NULL to > transmit all 0 bits and use the scratch variable for the rx_buf for > both the 1 byte command to and 2 byte response from the controller. > > Also relocates the scratch member of struct ser_req to force it > into a different cache line to prevent any potential issues of > DMA stepping on unrelated data in other struct members due to > sharing the same cache line. > > This change was tested on real TSC2046 and ADS7843 controllers, > but not the XPT2046 the workaround was originally created for. > Confirming that the original modification to clear the command > register does not impact either real controller. > > Fixes: 781a07da9bb94 ("Input: ads7846 - add dummy command register clearing cycle") > Cc: stable@vger.kernel.org > Co-developed-by: Mark Featherston > Signed-off-by: Mark Featherston > Signed-off-by: Kris Bahnsen > --- > > V1 -> V2: Don't use rx_buf when clearing command reg > V2 -> V3: Modify original 2 xfer command to eliminate dev_err() > output on xfer with len and NULL buffers > V3 -> V4: Move scratch to end of ser_req to force it to a new > cache line. > > V4 Note: Change to moving scratch was tested against an SPI > controller without DMA. We do not currently have a > platform using this controller on an SPI bus supporting > DMA. Marek, any chance you could give it a quick spin? Thanks! -- Dmitry