From patchwork Fri Aug 22 14:11:36 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Murphy X-Patchwork-Id: 4765231 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E92B69F2E8 for ; Fri, 22 Aug 2014 14:17:29 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 23BBA20155 for ; Fri, 22 Aug 2014 14:17:29 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E95252013A for ; Fri, 22 Aug 2014 14:17:27 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XKpcK-00010c-F8; Fri, 22 Aug 2014 14:15:00 +0000 Received: from comal.ext.ti.com ([198.47.26.152]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XKpZQ-0006Sy-Kd for linux-arm-kernel@lists.infradead.org; Fri, 22 Aug 2014 14:12:01 +0000 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id s7MEBcTM015608; Fri, 22 Aug 2014 09:11:38 -0500 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7MEBcCv030314; Fri, 22 Aug 2014 09:11:38 -0500 Received: from dflp32.itg.ti.com (10.64.6.15) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.174.1; Fri, 22 Aug 2014 09:11:37 -0500 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dflp32.itg.ti.com (8.14.3/8.13.8) with ESMTP id s7MEBbDZ030902; Fri, 22 Aug 2014 09:11:37 -0500 Received: from localhost (j-172-22-73-212.vpn.ti.com [172.22.73.212]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id s7MEBbt13896; Fri, 22 Aug 2014 09:11:37 -0500 (CDT) From: Dan Murphy To: , Subject: [PATCH] input: misc: drv260x: add check for ERM mode and LRA Libraries Date: Fri, 22 Aug 2014 09:11:36 -0500 Message-ID: <1408716696-1126-1-git-send-email-dmurphy@ti.com> X-Mailer: git-send-email 1.7.9.5 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140822_071200_783776_F625D79F X-CRM114-Status: UNSURE ( 9.04 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -5.7 (-----) Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Dan Murphy X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add a check to ensure that LRA libraries are not mixed with the ERM mode. If ERM mode and the Library is empty "OR" the LRA library then exit. As the LRA and empty libraries are not applicable for the ERM actuator. Signed-off-by: Dan Murphy --- drivers/input/misc/drv260x.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/misc/drv260x.c b/drivers/input/misc/drv260x.c index a7a19e6..d6a26a7 100644 --- a/drivers/input/misc/drv260x.c +++ b/drivers/input/misc/drv260x.c @@ -564,6 +564,14 @@ static int drv260x_probe(struct i2c_client *client, return -EINVAL; } + if (haptics->mode == DRV260X_ERM_MODE && + haptics->library == DRV260X_LIB_EMPTY || + haptics->library == DRV260X_LIB_LRA) { + dev_err(&client->dev, + "ERM Mode with LRA Library mismatch\n"); + return -EINVAL; + } + haptics->regulator = devm_regulator_get(&client->dev, "vbat"); if (IS_ERR(haptics->regulator)) { error = PTR_ERR(haptics->regulator);