From patchwork Mon Nov 14 13:11:14 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 9427483 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 7D05A60476 for ; Mon, 14 Nov 2016 13:12:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7450E2893A for ; Mon, 14 Nov 2016 13:12:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68F3028943; Mon, 14 Nov 2016 13:12:16 +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.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham 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 CCED62893A for ; Mon, 14 Nov 2016 13:12:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752955AbcKNNMO (ORCPT ); Mon, 14 Nov 2016 08:12:14 -0500 Received: from mx1.redhat.com ([209.132.183.28]:41760 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751613AbcKNNMN (ORCPT ); Mon, 14 Nov 2016 08:12:13 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF2D737E72; Mon, 14 Nov 2016 13:11:17 +0000 (UTC) Received: from shalem.localdomain.com (vpn1-5-80.ams2.redhat.com [10.36.5.80]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id uAEDBF7X010137; Mon, 14 Nov 2016 08:11:16 -0500 From: Hans de Goede To: Dmitry Torokhov Cc: linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Hans de Goede , "Dr . H . Nikolaus Schaller" Subject: [PATCH v2] input: bma150: Only claim to support the bma180 if the separate iio bma180 driver is not build Date: Mon, 14 Nov 2016 14:11:14 +0100 Message-Id: <20161114131114.6053-1-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 14 Nov 2016 13:11:17 +0000 (UTC) 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 commit ef3714fdbc8d ("Input: bma150 - extend chip detection for bma180"), adds bma180 chip-ids to the input bma150 driver, assuming that they are 100% compatible, but the bma180 is not compatible with the bma150 at all, it has 14 bits resolution instead of 10, and it has quite different control registers too. Treating the bma180 as a bma150 wrt its data registers will just result in throwing away the lowest 4 bits, which is not too bad. But the ctrl registers are a different story. Things happen to just work but supporting that certainly does not make treating the bma180 the same as the bma150 right. Since some setups depend on the evdev interface the bma150 driver offers on top of the bma180, we cannot simply remove the bma180 ids. So this commit only removes the bma180 id when the bma180 iio driver, which does treat the bma180 properly, is enabled. Cc: Dr. H. Nikolaus Schaller Signed-off-by: Hans de Goede --- Changes in v2: -Use IS_ENABLED(CONFIG_BMA180) instead of #ifdef CONFIG_BMA180 --- drivers/input/misc/bma150.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/input/misc/bma150.c b/drivers/input/misc/bma150.c index b0d4453..2124390 100644 --- a/drivers/input/misc/bma150.c +++ b/drivers/input/misc/bma150.c @@ -538,8 +538,13 @@ static int bma150_probe(struct i2c_client *client, return -EIO; } + /* + * Note if the IIO CONFIG_BMA180 driver is enabled we want to fail + * the probe for the bma180 as the iio driver is preferred. + */ chip_id = i2c_smbus_read_byte_data(client, BMA150_CHIP_ID_REG); - if (chip_id != BMA150_CHIP_ID && chip_id != BMA180_CHIP_ID) { + if (chip_id != BMA150_CHIP_ID && + (IS_ENABLED(CONFIG_BMA180) || chip_id != BMA180_CHIP_ID)) { dev_err(&client->dev, "BMA150 chip id error: %d\n", chip_id); return -EINVAL; } @@ -643,7 +648,9 @@ static UNIVERSAL_DEV_PM_OPS(bma150_pm, bma150_suspend, bma150_resume, NULL); static const struct i2c_device_id bma150_id[] = { { "bma150", 0 }, +#if !IS_ENABLED(CONFIG_BMA180) { "bma180", 0 }, +#endif { "smb380", 0 }, { "bma023", 0 }, { }