From patchwork Tue Mar 20 22:31:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 10298083 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1C7C860386 for ; Tue, 20 Mar 2018 22:33:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 02CD6291C1 for ; Tue, 20 Mar 2018 22:33:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E95E22966A; Tue, 20 Mar 2018 22:33:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8F500291C1 for ; Tue, 20 Mar 2018 22:33:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751499AbeCTWcI (ORCPT ); Tue, 20 Mar 2018 18:32:08 -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-Google-Smtp-Source: AG47ELvMzQ1BxjZT/PdyegKbgD2WFvTOveWY4dIn7eZt/K9u7cYk9gP/aw9VhZ9ttyGVGjf/yc/DzQ== 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-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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;