Received: by 10.213.65.68 with SMTP id h4csp238184imn; Mon, 12 Mar 2018 12:11:49 -0700 (PDT) X-Google-Smtp-Source: AG47ELskXAf5Xg78TD4oCx4nw7Hxhbkm7sc9PAsEeWwzcQu91a+XNmsClyYBnN3DM51ua2aeGGjz X-Received: by 2002:a17:902:1a2:: with SMTP id b31-v6mr9196442plb.203.1520881909327; Mon, 12 Mar 2018 12:11:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520881909; cv=none; d=google.com; s=arc-20160816; b=Dr7FOz+U/JpWWoqI4qrOJsJFGCjlq8RerjrbJ1wydi+enbrxP7mAr3geqrbHrqgmNC qnZvXVtln8eoSv/nHSncSNi2pvv8BeuKSdffXYNTAx6c/Sex63lXAOnfDQNJVrIZlFTZ ly5IpNO1sF3riqRJkMh7Vxq8jE1Ctl8AaVlU4dpPdDmNuuQ1OuiWbDiDcQS3Uk1SKASd 1j0bV8hip7fgMSE/b5sjsJfSqkHvzbUwpnHpmdkkNw06NlzCMsEWarbZKYTs84J9MeEP aeQpA15enZQfCqY7e5nVG9mg9QZOZJbCTj3fciTDwcO5vmyDaVYHup61LL8FtAjum88H XCWw== 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=HPP0A3IaechNLf4BEQSYRWwAJmNd92BmsOVqiM88IU0=; b=SeVlLebJ8LdPEBvj+0QPAm64WNFLZUXTQ0ouXEJ5YZxh8VnBcyGCfbIBSChBSM4PE5 BsGIAlSDhiigeedHi46/rQinh95jJS+si0DiaeJ+ao1wZGn7MKzpjADXI2RYpGS/NLXk H/odhFeMV6WL8GcxhOzcLMR+MU6EbZWHjNxtYlFnYDpkGZvueVnNbAAMwzmbLcdFbYo2 E19B1roi0BDylT6dUBRDhQjZ6+3vfzigsJbDC6XQ3f1n8ZHqoSwYxofMuRaTzMLDsAwR ddk4r+PssRNewtWjilLvmL5Jo1lyHDNU3ErPnEN2eH7+A8wQq9WsxYEOUITkTyHcIJHg qEJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cRH61W3a; 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 x24-v6si3028954pll.83.2018.03.12.12.11.35; Mon, 12 Mar 2018 12:11:49 -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=cRH61W3a; 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 S932545AbeCLTJ3 (ORCPT + 99 others); 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-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-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.660.g709887971b-goog