From patchwork Tue Jul 4 12:46:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 783937 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3x23f31vVwz9sNx for ; Tue, 4 Jul 2017 22:46:19 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751648AbdGDMqR (ORCPT ); Tue, 4 Jul 2017 08:46:17 -0400 Received: from mx1.redhat.com ([209.132.183.28]:49096 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbdGDMqR (ORCPT ); Tue, 4 Jul 2017 08:46:17 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF83580491; Tue, 4 Jul 2017 12:46:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AF83580491 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=hdegoede@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com AF83580491 Received: from shalem.localdomain.com (ovpn-117-72.ams2.redhat.com [10.36.117.72]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3D2C61751C; Tue, 4 Jul 2017 12:46:15 +0000 (UTC) From: Hans de Goede To: Jarkko Nikula , Wolfram Sang , Len Brown , Andy Shevchenko , Mika Westerberg Cc: Hans de Goede , linux-i2c@vger.kernel.org Subject: [PATCH] i2c: acpi: Do not create i2c-clients for LNXVIDEO ACPI devices Date: Tue, 4 Jul 2017 14:46:13 +0200 Message-Id: <20170704124613.14591-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Tue, 04 Jul 2017 12:46:16 +0000 (UTC) Sender: linux-i2c-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-i2c@vger.kernel.org ACPI video devices get tagged by the kernel with the custom LNXVIDEO HID so that normal pnp-id matching can be used and are handled by the acpi-video driver. Sometimes the ACPI nodes describing these contain a SERIAL_TYPE_I2C ACPI resource. Before this commit the presence of this resource would cause the i2c-core to create a /sys/bus/i2c/devices/i2c-LNXVIDEO:00 device for this with a modalias of: "i2c:LNXVIDEO:00". There is no i2c driver for this custom HID, the acpi-video driver binds directly to the ACPI device /sys/bus/acpi/devices/LNXVIDEO\:00 which has a modalias of "acpi:LNXVIDEO:" . Not only is the creation of an i2c-client for this undesirable, it is actually causing problems. This weird pseudo-resource claims an i2c speed of 100KHz and typically points to the i2c bus which is used by the touchscreen controller. Some touchscreen controllers only work properly at 400KHz, at 100KHz they cause errors like these: i2c_designware 80860F41:03: i2c_dw_handle_tx_abort: lost arbitration i2c_designware 80860F41:03: i2c_dw_handle_tx_abort: lost arbitration i2c_designware 80860F41:03: i2c_dw_handle_tx_abort: lost arbitration i2c_designware 80860F41:03: i2c_dw_handle_tx_abort: lost arbitration silead_ts i2c-MSSL1680:00: Registers clear error -11 This commit makes the i2c-core ignore LNXVIDEO compatible ACPI devices which has 2 positive results: 1) The bogus i2c-client for these is no longer created. 2) i2c_acpi_lookup_speed now ignores the 100KHz speed from the pseudo i2c-resouce and properly returns 400KHz as speed for the touchscreen i2c bus, fixing the touchscreen not working on various devies. Signed-off-by: Hans de Goede Reviewed-by: Andy Shevchenko --- Changes in v2: -Rebase on top of linux-i2c/for-next --- drivers/i2c/i2c-core-acpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/i2c/i2c-core-acpi.c b/drivers/i2c/i2c-core-acpi.c index 052005579ed6..bda281293d28 100644 --- a/drivers/i2c/i2c-core-acpi.c +++ b/drivers/i2c/i2c-core-acpi.c @@ -82,11 +82,22 @@ static int i2c_acpi_do_lookup(struct acpi_device *adev, struct i2c_board_info *info = lookup->info; struct list_head resource_list; int ret; + static const struct acpi_device_id video_device_ids[] = { + { ACPI_VIDEO_HID, 0 }, + {} + }; if (acpi_bus_get_status(adev) || !adev->status.present || acpi_device_enumerated(adev)) return -EINVAL; + /* + * ACPI video acpi_devices, which are handled by the acpi-video driver + * sometimes contain a SERIAL_TYPE_I2C ACPI resource, ignore these. + */ + if (acpi_match_device_ids(adev, video_device_ids) == 0) + return -ENODEV; + memset(info, 0, sizeof(*info)); lookup->device_handle = acpi_device_handle(adev);