Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp481555lqb; Wed, 17 Apr 2024 02:06:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/g3oJNyV9ItQuu+hYhjtxjloCDVg0PHXwNuVEcuDu35mqwa5jxXkgzLwLIh4vN0F5tHWRiO/bjZQL5fMfV+jQHMGVQ38luWbx3vOl7g== X-Google-Smtp-Source: AGHT+IGsH50BJ68inGs0LuAnr58xQGUa4TxgHX/4CWhWfT2CcID7H6lkz5AZBlnQMAmBUqnpkFlM X-Received: by 2002:a05:6808:683:b0:3c5:e2dc:8a6a with SMTP id k3-20020a056808068300b003c5e2dc8a6amr16859614oig.24.1713344783173; Wed, 17 Apr 2024 02:06:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713344783; cv=pass; d=google.com; s=arc-20160816; b=cPhHS5Xktnwr/mo5f41GWbsa7mK+dImbfMqmF+qUrr4Hlyrp/Wr9QQXFMybAbzfDwT 9kMzQAhtVfurkpw/9r/vOOmoTPfqO4gGFff23ejHNu741gWKEgMhaSswCF2o5aMV0UVP e8te9/wWMdrEErT2Y4x8fURNy3cCjnR7m7SNTzyyaHGIWEZYgHjM43ivLPcjMmtxdRx2 SIxajJFWsHsi5m8UeyVCvFb2d7U8QXCSm3q+Z1pycavaxPUl/yoE1Ha5yTG3I3j84Krr CKUh1e5brGo3g17VXZg8eRHS09r1BqVo8bEIOynaBlhsoqzxSj8pGIFvmzdTmBn83LW7 HdpQ== ARC-Message-Signature: i=2; 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:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=nVO7Y9spxZltLz0ZKBeWkeuDpaj3ufTmIIyjVVsXg/Y=; fh=PtTAW2V5Sn32IvorMAfybsTxJA+kzJ+H/WkJ1aoZhvg=; b=XzwAJP2ds3A3DFyqQRKFuNJhC2mDR/v2zgY4af26u2XnRN6JhGsDOQcyrtyyyTfC8Z GK2v0AmzNvnfm7Sbpr4czFgfkFiUkAytiypvRysN76IV50De92lXrT2a6E4Qg95RQUvj HlPHEDwU13LZZAkJYF/BuU3pImRFRczyglTN3FoFo63NpCgh8L3v34K2qBAuvB9HvMPc qX+LNcR7Wt77hPunPgMlyGRUysGBxJMDalTRVFckE1AkUEpsD3f49L5+VxRHvX2TRc2A yR3/qnA+xkdiKrNdRdK62N6kYh84+r8pt/pq9nS1yCVDgh7AVUKnHj/Au7xgZ2Jli0M3 cljg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RhzdD3LA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-148204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id w17-20020a05620a149100b0078bc60f13eesi14907146qkj.428.2024.04.17.02.06.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 02:06:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-148204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=RhzdD3LA; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-148204-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-148204-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.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 BA7F71C21A53 for ; Wed, 17 Apr 2024 09:06:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id ACCC2132C39; Wed, 17 Apr 2024 09:05:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RhzdD3LA" Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 73C2B12EBDB; Wed, 17 Apr 2024 09:05:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713344755; cv=none; b=i38zvhzMrcALzbT0OVFwybHSOiQ7RkpIld2ij+HR091q5yvB0hnBGmSfasGfNwAvmEvqhtIRBBWmAms/HzVETE0T4WGxHNYO5DgbDMLvoY4Qgjbd01l0aiheQ1pXCNyHtwf1Oujz9PXvyYPu39cq/oIFeX3eVrC8zUOVEec9u9s= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713344755; c=relaxed/simple; bh=2uYsElcOefKMaiubXZtKV2i4KRiPwfyEPELaTWFTBvw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=cN2oR8esbqs4Uw7EQuuuq2k0cnxTqIBnnwXVVC/etWhb6h1ysmZ7KI8qU+fmiOMJw+Z1f8HMysJ8l9sFAQMNfnIutbtAEe/DCuxpqBpNOgCsrE2Qm4Gwn248vzvUMz5jXEp0ZCU0lvyfaeOaCCanEjWFQp9D7Qhvn4MfF4Equu0= 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=RhzdD3LA; arc=none smtp.client-ip=209.85.208.47 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 Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-570005cdf62so4553343a12.2; Wed, 17 Apr 2024 02:05:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713344750; x=1713949550; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=nVO7Y9spxZltLz0ZKBeWkeuDpaj3ufTmIIyjVVsXg/Y=; b=RhzdD3LAVTtx1rDKTSB/fu1J0IPiBi9+zaMHckxaGEMwxyjZLyePzEL5qwfbwGWJSn 2WkVyc4i8ZjvdIJcuo1R7kL9HlQYGbAnxJFOrU3If8MIORwzm1BY0QqslBr1GtwPT5r9 9AA+8nUfbqhVvP+DttBQnv6ME1yBb8t1N1GfB4qmkDP3yBHwIttVQv8yoGqgoeMspdyd xScSO+mwDeO1a22J0H9CAJJj3l/yubsNCorwRGq+TZpsk5ZcaVK+toE3V+UvdimBeUoc M7JttkTjIGr3hi540eSzkJMTFdOXLI+LifuhrK4oC75/acb8qmj9/L4Rbk7pOMbOOJHZ Zk3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713344750; x=1713949550; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=nVO7Y9spxZltLz0ZKBeWkeuDpaj3ufTmIIyjVVsXg/Y=; b=VkSxY8Sm1QhxrhbVNO6n/eevk5UaM+nJO2q5zAxa72JS2TUB7fIMeL7EgvTS+b9L2k QToN5ZVQJCEg53Wo+BUN9iycCAhC7Cc2EDEJTnJjvY9n2U1k2iQoSgBTzf0ZLE6HcqtF Nqkb8dynCb8Bn6DjDQQ9uNgC8jCOdnuqDWM/kg3lh4t1YGX7Husg/F48bYhLs/v8YxgK IuVzdhP7MDP7iFOLq0KsBIWG10H4XZulY3QoJbkSKAoz1OKACOzam1SxaGf/7s9LvSvu VJGMSnt+OI49NHp1VqJt7rUaRlBNPs613ufoNJYKpcga1g6VrY4fphLOGy+lUvBF0IRK glzQ== X-Forwarded-Encrypted: i=1; AJvYcCV0zLPutK/f7xXyLzX7byFgPYl7irUIVjAbPM/73q4/MBePcSMQnBetpF8LufA72CHV4wcHHWcO1DwP4xJ77tFsjDim0DVE9nk90W4yMRuREFowptCwGH4MSLbKCZ3oFgm17O4AfzEXgw== X-Gm-Message-State: AOJu0Yx4vEVBbGN6CVvz21IawNYLEdqxE26//qgPj4U2xFBky5urIiCb T1XAW/Y2TzNlo2XhTlkH4IqCqrDoyv/mjnrh34JOU2l+S7vThfeN X-Received: by 2002:a17:907:6e87:b0:a52:3d07:de62 with SMTP id sh7-20020a1709076e8700b00a523d07de62mr11939733ejc.58.1713344749669; Wed, 17 Apr 2024 02:05:49 -0700 (PDT) Received: from eichest-laptop.corp.toradex.com (31-10-206-125.static.upc.ch. [31.10.206.125]) by smtp.gmail.com with ESMTPSA id x16-20020a170906135000b00a51a7832a7asm7897814ejb.199.2024.04.17.02.05.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Apr 2024 02:05:49 -0700 (PDT) From: Stefan Eichenberger To: nick@shmanahar.org, dmitry.torokhov@gmail.com, robh@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, nicolas.ferre@microchip.com, alexandre.belloni@bootlin.com, claudiu.beznea@tuxon.dev, linus.walleij@linaro.org Cc: linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Stefan Eichenberger Subject: [PATCH v4 2/4] Input: atmel_mxt_ts - move calls to register the input device to separate function Date: Wed, 17 Apr 2024 11:05:25 +0200 Message-Id: <20240417090527.15357-3-eichest@gmail.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240417090527.15357-1-eichest@gmail.com> References: <20240417090527.15357-1-eichest@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Stefan Eichenberger The calls to register the input device are moved to a separate function so that we can call it without having to confiugre the device. This is necessary if we want to power on the device only when it is opened. Signed-off-by: Stefan Eichenberger --- drivers/input/touchscreen/atmel_mxt_ts.c | 34 +++++++++++++++++------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 52867ce3b9b6..7c807d1f1f9b 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2277,6 +2277,28 @@ static void mxt_config_cb(const struct firmware *cfg, void *ctx) release_firmware(cfg); } +static void mxt_debug_init(struct mxt_data *data); + +static int mxt_device_register(struct mxt_data *data) +{ + int error; + + /* If input device is not already registered */ + if (!data->input_dev) { + if (data->multitouch) { + error = mxt_initialize_input_device(data); + if (error) + return error; + } else { + dev_warn(&data->client->dev, "No touch object detected\n"); + } + + mxt_debug_init(data); + } + + return 0; +} + static int mxt_initialize(struct mxt_data *data) { struct i2c_client *client = data->client; @@ -2831,15 +2853,9 @@ static int mxt_configure_objects(struct mxt_data *data, dev_warn(dev, "Error %d updating config\n", error); } - if (data->multitouch) { - error = mxt_initialize_input_device(data); - if (error) - return error; - } else { - dev_warn(dev, "No touch object detected\n"); - } - - mxt_debug_init(data); + error = mxt_device_register(data); + if (error) + return error; return 0; } -- 2.40.1