From patchwork Tue Jan 5 12:59:15 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreste Salerno X-Patchwork-Id: 7954801 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DD96F9F3F6 for ; Tue, 5 Jan 2016 13:00:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 20ED420303 for ; Tue, 5 Jan 2016 13:00:25 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1A0EE202FE for ; Tue, 5 Jan 2016 13:00:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752391AbcAENAL (ORCPT ); Tue, 5 Jan 2016 08:00:11 -0500 Received: from mail3.tomtom.com ([85.90.76.132]:10210 "EHLO mail3.tomtom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751608AbcAEM70 (ORCPT ); Tue, 5 Jan 2016 07:59:26 -0500 Received: from NLSRVWP-EXC02.ttg.global (10.96.72.12) by nlsrvwp-tmg01.ttg.global (10.96.64.21) with Microsoft SMTP Server (TLS) id 14.3.169.1; Tue, 5 Jan 2016 13:59:46 +0100 Received: from NLSRVWP-EXN11.ttg.global (10.98.64.12) by NLSRVWP-EXC02.ttg.global (10.96.72.12) with Microsoft SMTP Server (TLS) id 14.3.235.1; Tue, 5 Jan 2016 13:59:20 +0100 Received: from nl1lxl-107192.ttg.global (10.98.250.94) by NLSRVWP-EXN11.ttg.global (10.98.64.12) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Tue, 5 Jan 2016 13:59:19 +0100 From: Oreste Salerno To: CC: , , , , , , , , , Subject: [PATCH v2 3/3] Input: cyttsp - add default init function Date: Tue, 5 Jan 2016 13:59:15 +0100 Message-ID: X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 X-Originating-IP: [10.98.250.94] X-ClientProxiedBy: NLSRVWP-EXN10.ttg.global (10.98.64.11) To NLSRVWP-EXN11.ttg.global (10.98.64.12) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 When using device trees, it's not possible to assign an init() function in the platform data. In case the init function has not been assigned, attempt to perform a hard reset of the chip, using reset gpio defined in the platform data / device tree. Signed-off-by: Oreste Salerno --- drivers/input/touchscreen/cyttsp_core.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/input/touchscreen/cyttsp_core.c b/drivers/input/touchscreen/cyttsp_core.c index 8390236..9872333 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -238,6 +238,16 @@ static int cyttsp_set_sysinfo_regs(struct cyttsp *ts) return retval; } +static void cyttsp_hard_reset(struct cyttsp *ts) +{ + if (ts->pdata->reset_gpio) { + gpiod_set_value_cansleep(ts->pdata->reset_gpio, 1); + msleep(CY_DELAY_DFLT); + gpiod_set_value_cansleep(ts->pdata->reset_gpio, 0); + msleep(CY_DELAY_DFLT); + } +} + static int cyttsp_soft_reset(struct cyttsp *ts) { unsigned long timeout; @@ -659,6 +669,8 @@ struct cyttsp *cyttsp_probe(const struct cyttsp_bus_ops *bus_ops, error); goto err_free_mem; } + } else { + cyttsp_hard_reset(ts); } input_dev->name = pdata->name;