From patchwork Sun Jan 10 17:36:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oreste Salerno X-Patchwork-Id: 7997491 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 C0C5B9F3F6 for ; Sun, 10 Jan 2016 17:36:39 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0061E20270 for ; Sun, 10 Jan 2016 17:36:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01B1A2025B for ; Sun, 10 Jan 2016 17:36:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757311AbcAJRgZ (ORCPT ); Sun, 10 Jan 2016 12:36:25 -0500 Received: from mail3.tomtom.com ([85.90.76.132]:56423 "EHLO mail3.tomtom.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757268AbcAJRgY (ORCPT ); Sun, 10 Jan 2016 12:36:24 -0500 Received: from NLSRVWP-EXC01.ttg.global (10.96.72.11) by nlsrvwp-tmg02.ttg.global (10.96.64.22) with Microsoft SMTP Server (TLS) id 14.3.169.1; Mon, 11 Jan 2016 01:20:45 +0100 Received: from NLSRVWP-EXN02.ttg.global (10.98.64.19) by NLSRVWP-EXC01.ttg.global (10.96.72.11) with Microsoft SMTP Server (TLS) id 14.3.235.1; Sun, 10 Jan 2016 18:36:19 +0100 Received: from nl1lxl-107192.tomtomgroup.com (10.98.250.94) by NLSRVWP-EXN02.ttg.global (10.98.64.19) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Sun, 10 Jan 2016 18:36:19 +0100 From: Oreste Salerno To: CC: , , , , , , , , , Subject: [PATCH v3 3/3] Input: cyttsp - add default init function Date: Sun, 10 Jan 2016 18:36:09 +0100 Message-ID: <01aa2661875444ecc771dfce1f466b6846ac5eea.1452447124.git.oreste.salerno@tomtom.com> 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-EXN09.ttg.global (10.98.64.10) To NLSRVWP-EXN02.ttg.global (10.98.64.19) 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 5dc6bf6..baf0fd5 100644 --- a/drivers/input/touchscreen/cyttsp_core.c +++ b/drivers/input/touchscreen/cyttsp_core.c @@ -239,6 +239,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; @@ -685,6 +695,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;