Received: by 10.213.65.68 with SMTP id h4csp786482imn; Tue, 20 Mar 2018 15:35:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELvjs2MsjNNn6ln7wvTQ0yVyur8sUdzYO1aZU924mHZKlNDYbASH33JPjPQ3+bZn/Rf1ILoS X-Received: by 10.98.98.194 with SMTP id w185mr15033085pfb.206.1521585319332; Tue, 20 Mar 2018 15:35:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521585319; cv=none; d=google.com; s=arc-20160816; b=WfxR0jiNJckOOkZ1/qS9NFMb5f9XsacDDis6DtFJI5jHOrAVXq3pH7HPT3pAZyKny7 Vmsp9kybHdlxm6D6+b808ph2XMJsD6I9WZhFm0fS2y3ayo+6E4DEvY1pRPOiXGMvb3kt 2VP1GoygrloWrM2Xtqs4qTtifVOHM/NCdPkkSCZFmVuEKr+MYYdFLpCL/Q0mpjKvq8u6 25KUDmzzO2EeJF/5YHAANJSX8lj7FwySXhqdDq+dpbptgTGcPABHBGxZ4n6aEzjW0MIE eJyr6/VmUjkh68TNoZIjT679DwuKrdq6At5l7RmNGLMXDZkqKIclt+qzxVbpccDEg0V0 5dMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=5xi8mVsJ+3iekddyxKEMxRcJWEriezTVFqnUwYPkurI=; b=cfU8JbdLC3QfM1vtGA27TqmbsV9TPwGrru2qglQsLNkUIbgWJyvQo8bpNWyL83lKhi rZ8RqhU1NC6i/TMIWVCXHOs82fYe3Q0ODlYM2pzcLDWZqBfXbhN+JLFffQiw87FPIGBh rNR7XZFrAJCeySKfiMwnV8zxGAFxZZYEmNaDY3s5kIRGm3u9QqzBlfdM+HwE0zxxYgv9 J882KsviutSefFj9Hn5kNZp4uIR2Q7qCM21c3Ecsv22vPBnX+Ze41xAgZEh00daWtR+G 0iwoK9V1f+RDV5nPbNyX66g1QXDOABrtWZLtI28BcLi4LX89EkrPngwFwE5WyxOOZzrB nfFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q4Sb2nLI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f9si1760116pgq.799.2018.03.20.15.35.05; Tue, 20 Mar 2018 15:35:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Q4Sb2nLI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751870AbeCTWb6 (ORCPT + 99 others); Tue, 20 Mar 2018 18:31:58 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:46526 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751776AbeCTWbq (ORCPT ); Tue, 20 Mar 2018 18:31:46 -0400 Received: by mail-pg0-f66.google.com with SMTP id g8so1206595pgq.13; Tue, 20 Mar 2018 15:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5xi8mVsJ+3iekddyxKEMxRcJWEriezTVFqnUwYPkurI=; b=Q4Sb2nLIfURKOBjz615mTrYK8LGcgtEb2OocuMZoc8gLYcL929WloK931e8IkDkJ2Y 2H+BOyi/85zPGnXzu2v0TdO9h8DR0mAit3yD+JTjkRqz6Wux3vmTOipYhRARS8A6ZI5k Pp3KQvk2l7Lo4auCcskExNyrLpIsfpQX4+JulMMvJXqF+fc6vMeP5KovRz56tuTJ2ed/ p9ZYXtBt5JF/RNM5HSXzZIVmge8NQVPGvgOQ+Y4ANuJGWmE+TWGC+aRJkppyl1xeCLHG hJ+BqWnCMCrQPbp4fso7Inb4SK9fJdtwxcBi5rpOw9nwHTj0jcJgC7QlwFdWfuuO21GM EzyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=5xi8mVsJ+3iekddyxKEMxRcJWEriezTVFqnUwYPkurI=; b=LPY85m8Q3s0uWLt+2KMvALoswt0ljrDDXIAtlgwmyeIJnhJ7y8BByHkk0uVkbo1niF nGzGfErAMUdl3qDn4a4ryHJpNo+ByDaDk7W/eFs4Ut2G2TMyT/jT+cOtPLJ+BI+WdJsH DPDU9ZRqq9kCkRk1UjW5S5o4xVNb68EtjkxRmQYVFHbB3SePFD96s2E+74lWzVBe0NpA Yme00hwfjBaoka54wfertYfJHko/HlvP0+zfPxxHxi7ptUQc9OXt5B2+g1MiCJHhtxE0 nRkzrDPXW9PX/cepSLaMST31OkSQIzYFI+EHDMt6QKN9f1TDidyXnT5cra+XdT0wgrK2 Ue4w== X-Gm-Message-State: AElRT7E96o/RhjTy2/hS8k0MY32/BgTCeA/vJVx/uPnHzEYRQ9TtFujo 4KOHNwaKoYHzML2tz60Wydkh4Ijy X-Received: by 10.101.99.26 with SMTP id g26mr7057274pgv.442.1521585105707; Tue, 20 Mar 2018 15:31:45 -0700 (PDT) Received: from dtor-ws.mtv.corp.google.com ([2620:0:1000:1511:8de6:27a8:ed13:2ef5]) by smtp.gmail.com with ESMTPSA id r20sm6108360pff.165.2018.03.20.15.31.44 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 15:31:44 -0700 (PDT) From: Dmitry Torokhov To: linux-input@vger.kernel.org, Benson Leung Cc: Nick Dyer , Olof Johansson , linux-kernel@vger.kernel.org Subject: [PATCH v2 03/14] Input: atmel_mxt_ts - switch ChromeOS ACPI devices to generic props Date: Tue, 20 Mar 2018 15:31:27 -0700 Message-Id: <20180320223138.234724-4-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.16.2.804.g6dcf76e118-goog In-Reply-To: <20180320223138.234724-1-dmitry.torokhov@gmail.com> References: <20180320223138.234724-1-dmitry.torokhov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move older ChromeOS devices describing Atmel controllers in ACPI, but not providing enough details to configure the controllers properly, from platform data over to generic device properties. This will allow us remove support for platform data later on, leaving only generic device properties in place. Acked-by: Nick Dyer Signed-off-by: Dmitry Torokhov --- drivers/input/touchscreen/atmel_mxt_ts.c | 63 +++++++++++++++--------- 1 file changed, 40 insertions(+), 23 deletions(-) diff --git a/drivers/input/touchscreen/atmel_mxt_ts.c b/drivers/input/touchscreen/atmel_mxt_ts.c index 73d9c0254ad76..799d2ac35787b 100644 --- a/drivers/input/touchscreen/atmel_mxt_ts.c +++ b/drivers/input/touchscreen/atmel_mxt_ts.c @@ -2974,7 +2974,7 @@ mxt_parse_device_properties(struct i2c_client *client) struct mxt_acpi_platform_data { const char *hid; - struct mxt_platform_data pdata; + const struct property_entry *props; }; static unsigned int samus_touchpad_buttons[] = { @@ -2984,14 +2984,16 @@ static unsigned int samus_touchpad_buttons[] = { BTN_LEFT }; +static const struct property_entry samus_touchpad_props[] = { + PROPERTY_ENTRY_U32_ARRAY("linux,gpio-keymap", samus_touchpad_buttons), + { } +}; + static struct mxt_acpi_platform_data samus_platform_data[] = { { /* Touchpad */ .hid = "ATML0000", - .pdata = { - .t19_num_keys = ARRAY_SIZE(samus_touchpad_buttons), - .t19_keymap = samus_touchpad_buttons, - }, + .props = samus_touchpad_props, }, { /* Touchscreen */ @@ -3009,14 +3011,16 @@ static unsigned int chromebook_tp_buttons[] = { BTN_LEFT }; +static const struct property_entry chromebook_tp_props[] = { + PROPERTY_ENTRY_U32_ARRAY("linux,gpio-keymap", chromebook_tp_buttons), + { } +}; + static struct mxt_acpi_platform_data chromebook_platform_data[] = { { /* Touchpad */ .hid = "ATML0000", - .pdata = { - .t19_num_keys = ARRAY_SIZE(chromebook_tp_buttons), - .t19_keymap = chromebook_tp_buttons, - }, + .props = chromebook_tp_props, }, { /* Touchscreen */ @@ -3046,7 +3050,7 @@ static const struct dmi_system_id mxt_dmi_table[] = { { } }; -static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) +static int mxt_acpi_probe(struct i2c_client *client) { struct acpi_device *adev; const struct dmi_system_id *system_id; @@ -3063,33 +3067,46 @@ static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) * as a threshold. */ if (client->addr < 0x40) - return ERR_PTR(-ENXIO); + return -ENXIO; adev = ACPI_COMPANION(&client->dev); if (!adev) - return ERR_PTR(-ENOENT); + return -ENOENT; system_id = dmi_first_match(mxt_dmi_table); if (!system_id) - return ERR_PTR(-ENOENT); + return -ENOENT; acpi_pdata = system_id->driver_data; if (!acpi_pdata) - return ERR_PTR(-ENOENT); + return -ENOENT; while (acpi_pdata->hid) { - if (!strcmp(acpi_device_hid(adev), acpi_pdata->hid)) - return &acpi_pdata->pdata; + if (!strcmp(acpi_device_hid(adev), acpi_pdata->hid)) { + /* + * Remove previously installed properties if we + * are probing this device not for the very first + * time. + */ + device_remove_properties(&client->dev); + + /* + * Now install the platform-specific properties + * that are missing from ACPI. + */ + device_add_properties(&client->dev, acpi_pdata->props); + break; + } acpi_pdata++; } - return ERR_PTR(-ENOENT); + return 0; } #else -static const struct mxt_platform_data *mxt_parse_acpi(struct i2c_client *client) +static int mxt_acpi_probe(struct i2c_client *client) { - return ERR_PTR(-ENOENT); + return -ENOENT; } #endif @@ -3102,10 +3119,6 @@ mxt_get_platform_data(struct i2c_client *client) if (pdata) return pdata; - pdata = mxt_parse_acpi(client); - if (!IS_ERR(pdata) || PTR_ERR(pdata) != -ENOENT) - return pdata; - return mxt_parse_device_properties(client); } @@ -3130,6 +3143,10 @@ static int mxt_probe(struct i2c_client *client, const struct i2c_device_id *id) const struct mxt_platform_data *pdata; int error; + error = mxt_acpi_probe(client); + if (error && error != -ENOENT) + return error; + pdata = mxt_get_platform_data(client); if (IS_ERR(pdata)) return PTR_ERR(pdata); -- 2.16.2.804.g6dcf76e118-goog