Received: by 10.213.65.68 with SMTP id h4csp785575imn; Tue, 20 Mar 2018 15:33:47 -0700 (PDT) X-Google-Smtp-Source: AG47ELu6CkCX1HmITcAkBFcfZDlhMBvk2TsLwYwKKnXVIhWiIdDvMFgMe1zeK2OxQdx75I91xmUh X-Received: by 10.101.101.133 with SMTP id u5mr13174987pgv.151.1521585227611; Tue, 20 Mar 2018 15:33:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521585227; cv=none; d=google.com; s=arc-20160816; b=nMdNYJGTa8XlaSnB86Ov3OJQsG3Ci4JYMrZPhUeuD7bMiF1iGJK4pgsEuSQDT9vrRG DY6qcTpkNvtRy4IuNJJSP864Wly8As8afJVdfrGltDTI/XNaV+L/h0SG8LHEdrynU3R2 LQXjl14zBaW4LJTZRPYYKdwG4gv1IfhHMShqu6cuamGdN8bvvDA+QY0jlVR1Xe9jnfMx 6e0AaW4lKOEvEyyl9Ft7FrMGlemV1IEP6JUfKwwQ6unYXHXTXG8WasDXlXr25LRA58Tk JzpxCOY9GbtxFum2gtDhovdzos7h7QDlcdNtByDvEy0Oe1svylBjOQ9GpyjnB56hMHOT zWrw== 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=y1uSdzq5ew0+uwPjHyyy1Lm22wB6cQYgRXj63JiQGNQ=; b=FpABDYvB90j6P8eA1WVEZTzonp2qVYFLKVi9oOIQ95DM10P8BSyeELciC18QGpoJCo fTxmOvnX9d0yGzrce8o3rMszV/3cETOkn3rTZARPVconNZljaR+oOoPwAZWyjBjCnzY3 QtnPgpsBqvZRky0yADu6f8pWDy4vXC9SegQ3DI867hdSYUvq8n3EBhRymAjb5iLZ6vuH bXhjILOIB1o3+lHvDsX479Cl49t1B5Je2DZUuMoHbkg41EsUg72T/m2P6oad9S1q7bHh d2/2uXTN3K/+0/A62kHCo2ZxcDQFj+/4Ubuj1I3qbS061/lCE7hOHPc9oKR644G+MTWX UfZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=E9HlUK4Y; 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 67-v6si2477733ple.311.2018.03.20.15.33.33; Tue, 20 Mar 2018 15:33:47 -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=E9HlUK4Y; 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 S1752041AbeCTWcZ (ORCPT + 99 others); Tue, 20 Mar 2018 18:32:25 -0400 Received: from mail-pf0-f194.google.com ([209.85.192.194]:42164 "EHLO mail-pf0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751873AbeCTWb6 (ORCPT ); Tue, 20 Mar 2018 18:31:58 -0400 Received: by mail-pf0-f194.google.com with SMTP id a16so1229889pfn.9; Tue, 20 Mar 2018 15:31:58 -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=y1uSdzq5ew0+uwPjHyyy1Lm22wB6cQYgRXj63JiQGNQ=; b=E9HlUK4Y3p9FgOWI1ATRll65iDt+8p4dLTPz/yaCUyTbvVyLprp/2KJDuHDU+yQMs4 GnGYkhmorFLnnJIlxradxM4yIRiGu4VnUivwgk+YtK1OhvhJbWhl8XmZ6QWmdX5GSW7v i0RWTvYLqAHW/n6EDbS7y/gPXcsl3nVX++tR7R20JIfhEcUlMLD1tBcP+Rajqickc67z 5CXt/FmxoDyPLnOs4R5WpFeIq4/rNMN7oRaorY+Q6QtDcaohNeubBeLQIyWhWgBFdH37 qymOyeyYFYI+gvID4DlTLOObPM3M9IzxsO8kI7hVA0eGJj+aMoMcJ7e/ch4FhEOBF1cE F6FA== 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=y1uSdzq5ew0+uwPjHyyy1Lm22wB6cQYgRXj63JiQGNQ=; b=GfI5BdYMTk4LipYCmwV6KHy0XncGioB7MuFELtNhjT9mpPfnIwylYgAT3KXoedQI/l x71mcP8uJYCZ0CNL6DxKQXRvBd9pBqrd36q+WcJIFhZjPMhMuND1MImIyD4K/PTjG9+H /qwFyiyNkPVb8ANmz6UqWt3WZrDX7tlyubRXzzQ+iz4LNdQlBwDTof0ObAwqNUYeCc/7 m0N9EnNMKy33pQV4WR1/vjs/M/61TzsMzJyhtHvj0ruN2YeX7o14zqbyhMEZQsEhlvp+ Lr4+YNTDNyYKPmTiilTDCw3SBQB9w7O+YaKAZIkSxtHHtz0q43uXauY+DhF+Dt3CAnbD XBCw== X-Gm-Message-State: AElRT7Gr1j+1KxDztmZUH8LWsYy2N0C5K6rZ9TzU87o4vTfltHBbwA4m rjN2ujYgTIdkNtbLaRep750iW0ul X-Received: by 10.98.200.9 with SMTP id z9mr8928419pff.128.1521585117301; Tue, 20 Mar 2018 15:31:57 -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.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 20 Mar 2018 15:31:55 -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 11/14] platform/chrome: chromeos_laptop - rely on I2C to set up interrupt trigger Date: Tue, 20 Mar 2018 15:31:35 -0700 Message-Id: <20180320223138.234724-12-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 Instead of passing interrupt flags via platform data to drivers, or hoping that drivers will do the right thing and set it up the way we need, let's set up IRQ resource and attach it to the I2C board info, and let I2C core set it up for us. Signed-off-by: Dmitry Torokhov --- drivers/platform/chrome/chromeos_laptop.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/platform/chrome/chromeos_laptop.c b/drivers/platform/chrome/chromeos_laptop.c index e5015dfaa81ec..1191c1a3a0cd1 100644 --- a/drivers/platform/chrome/chromeos_laptop.c +++ b/drivers/platform/chrome/chromeos_laptop.c @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -42,7 +43,11 @@ enum i2c_adapter_type { struct i2c_peripheral { struct i2c_board_info board_info; unsigned short alt_addr; + const char *dmi_name; + unsigned long irqflags; + struct resource irq_resource; + enum i2c_adapter_type type; u32 pci_devid; @@ -215,10 +220,6 @@ static struct chromeos_laptop samsung_series_5 = { }, }; -static struct mxt_platform_data atmel_1664s_platform_data = { - .irqflags = IRQF_TRIGGER_FALLING, -}; - static int chromebook_pixel_tp_keys[] = { KEY_RESERVED, KEY_RESERVED, @@ -229,7 +230,6 @@ static int chromebook_pixel_tp_keys[] = { }; static struct mxt_platform_data chromebook_pixel_tp_platform_data = { - .irqflags = IRQF_TRIGGER_FALLING, .t19_num_keys = ARRAY_SIZE(chromebook_pixel_tp_keys), .t19_keymap = chromebook_pixel_tp_keys, }; @@ -241,10 +241,10 @@ static struct chromeos_laptop chromebook_pixel = { .board_info = { I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR), - .platform_data = &atmel_1664s_platform_data, .flags = I2C_CLIENT_WAKE, }, .dmi_name = "touchscreen", + .irqflags = IRQF_TRIGGER_FALLING, .type = I2C_ADAPTER_PANEL, .alt_addr = ATMEL_TS_I2C_BL_ADDR, }, @@ -258,6 +258,7 @@ static struct chromeos_laptop chromebook_pixel = { .flags = I2C_CLIENT_WAKE, }, .dmi_name = "trackpad", + .irqflags = IRQF_TRIGGER_FALLING, .type = I2C_ADAPTER_VGADDC, .alt_addr = ATMEL_TP_I2C_BL_ADDR, }, @@ -356,10 +357,10 @@ static struct chromeos_laptop acer_c720 = { .board_info = { I2C_BOARD_INFO("atmel_mxt_ts", ATMEL_TS_I2C_ADDR), - .platform_data = &atmel_1664s_platform_data, .flags = I2C_CLIENT_WAKE, }, .dmi_name = "touchscreen", + .irqflags = IRQF_TRIGGER_FALLING, .type = I2C_ADAPTER_DESIGNWARE, .pci_devid = PCI_DEVID(0, PCI_DEVFN(0x15, 0x2)), .alt_addr = ATMEL_TS_I2C_BL_ADDR, @@ -558,6 +559,12 @@ chromeos_laptop_prepare(const struct dmi_system_id *id) irq = chromeos_laptop_get_irq_from_dmi(i2c_dev->dmi_name); if (irq < 0) return ERR_PTR(irq); + + i2c_dev->irq_resource = (struct resource) + DEFINE_RES_NAMED(irq, 1, NULL, + IORESOURCE_IRQ | i2c_dev->irqflags); + i2c_dev->board_info.resources = &i2c_dev->irq_resource; + i2c_dev->board_info.num_resources = 1; } return cros_laptop; -- 2.16.2.804.g6dcf76e118-goog