From patchwork Mon Mar 12 19:09:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 10277117 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 6B56F603B5 for ; Mon, 12 Mar 2018 19:10:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5DE1228E2F for ; Mon, 12 Mar 2018 19:10:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5C52528E63; Mon, 12 Mar 2018 19:10:07 +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 E684728E2F for ; Mon, 12 Mar 2018 19:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932534AbeCLTJ3 (ORCPT ); Mon, 12 Mar 2018 15:09:29 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:40166 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932479AbeCLTJZ (ORCPT ); Mon, 12 Mar 2018 15:09:25 -0400 Received: by mail-pl0-f68.google.com with SMTP id x3-v6so3366154plo.7; Mon, 12 Mar 2018 12:09:25 -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=HPP0A3IaechNLf4BEQSYRWwAJmNd92BmsOVqiM88IU0=; b=cRH61W3a24FGa9OlWgm6eFoRDv6OxgKk8Y6FZZGDZ61Dt7T+/+DrxCtIHB7e+S/8RR fdfEq7HgRgySzoa0a3hg8UsDm2fOne8Eg3gUI25A7n0Bg2bE8diRLYMn/aJZzw6l4DdS kRYcPoC0+GDRUZApr4kH0G0Yhn2K8Bn9929quSW49QVCPlNWwnovKX4exXye2oyvdyvG jCXXkPzDH1Hlc17R8TZdxZsPpGMGpsM85K+jU+4ZVd2XvzEW4hOAlTDT3Py3e5NSsBKL LEWWvmaj0cvKU3qS7cm4pqr6Cf7S61dwBe1OvDzr9AX7FPR80WFg/CBRsxxIbKXnxYm/ nCxw== 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=HPP0A3IaechNLf4BEQSYRWwAJmNd92BmsOVqiM88IU0=; b=H2TntKvjgxAqVrtA+//mAIpPrKLC0eAZh0HbLnoBq+23qaViflfKLzqvJmGe+EMO/E cNg1gZ0facEimIZeJF/SFud2SYkTVvyZHrqjj58gOjR2w1JQt5mQAgzZrvbvunYGIhia 3W7cngU/y9+5DglbEAjedlUUQDDDbcsiQBcxV3sgHC5IEoBgcyJyJnexOwQVfHUiukr8 80HVzMLGjn907R1JHJ61qwbjWCDX/Ouke+g4Ye/Ei/5Y47JJNKsHnWtR7tiB73vha1p9 Yw2vWtqgvfaInO3Wa7EbmOjarQYF3i+Cyb/G/LNfu7wOydVhKkg90nAYqfHpaGRJGV/x Bs2Q== X-Gm-Message-State: AElRT7ENgjUFY0aEmhCcUEpZFsagThEMSyYOC1f4W4Kt3JukPJArycBP BNl7UEwKAUBjD94HgvF2J4dRvnoG X-Google-Smtp-Source: AG47ELsRZAO3hOPIibdvb5Cnr8oZOtv2chPVbmFVvLdoVvZRcIasAb+9Q/lGheeipnILm0zPh04WAg== X-Received: by 2002:a17:902:9a8d:: with SMTP id w13-v6mr9185627plp.136.1520881764712; Mon, 12 Mar 2018 12:09:24 -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 s67sm18038477pfg.104.2018.03.12.12.09.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 12 Mar 2018 12:09:23 -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 11/14] platform/chrome: chromeos_laptop - rely on I2C to set up interrupt trigger Date: Mon, 12 Mar 2018 12:09:04 -0700 Message-Id: <20180312190907.174301-12-dmitry.torokhov@gmail.com> X-Mailer: git-send-email 2.16.2.660.g709887971b-goog In-Reply-To: <20180312190907.174301-1-dmitry.torokhov@gmail.com> References: <20180312190907.174301-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;