From patchwork Thu Mar 9 14:31:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yegor Yefremov X-Patchwork-Id: 9613459 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 31A63602B4 for ; Thu, 9 Mar 2017 14:33:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 241412863D for ; Thu, 9 Mar 2017 14:33:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 16E942863F; Thu, 9 Mar 2017 14:33:52 +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.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID 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 71D8B2863D for ; Thu, 9 Mar 2017 14:33:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932075AbdCIOc2 (ORCPT ); Thu, 9 Mar 2017 09:32:28 -0500 Received: from mail-wm0-f68.google.com ([74.125.82.68]:36428 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754646AbdCIOcH (ORCPT ); Thu, 9 Mar 2017 09:32:07 -0500 Received: by mail-wm0-f68.google.com with SMTP id v190so11224443wme.3 for ; Thu, 09 Mar 2017 06:31:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=YeHFhl4myeUVWP/tIzvduNUJvSKwM5iyVs1iGtbAEI4=; b=hkp+XVwL7frnn7U9b1Kk9wR+QkF9W9p0yIv0djDxLxRVtW17y3Kg+8Wjnr1SXZWksj yOnO3lPK3aZYhV+kg2a93ycB2K+PpDnqjAFs764ezgW7iFywnQGWpw5PcJeKRCmGLLFE BjoPhEEHT005S1t0QRkao3XJkGU3gHp06bwaUNCdD0luiCxnE4FWZ4qTM5LsYLiPP5tb uP++9eW1ZKHQNAnSFSBzCHpPRm/TcxeLm/RR95LyFHkPkcposfk3MHPRLYN97eKHK20m m19ov+yHDaAu20dktMZq3hE3d/B2zwZt2x4ROo3Y+JoIlrQMUn90hYs5YWs/CuaFOOWP gllg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=YeHFhl4myeUVWP/tIzvduNUJvSKwM5iyVs1iGtbAEI4=; b=Wan39SctERmrsYGfUJGopq03mj8TOC6INrOLwy0QUe6xUErmDjRoUwzZT5zng6AVXY oADGKwno2k6PsCJIvE+JUGlIWjLDQHKAF0+JT2wSDuKgiVcRx5dBvSyPGXQ/UurULN4J SUZvB/rC9CCPBqWXCzDYM9bpJv9KnQktnIw7MauMCgoW1y7C3CRyESOJ2TW4shELqt0P ncEWngCy/Uo6NFtxUIqvpLJ3d4b27Jy5lXwB+zzWdLuhAZYm/roQXb6VOCM6YmNRdUbP Oal/ffX9K+MlhPTfMfONqgMAS6jXgWZb2jcs+JUMWv/jGLgGFCH3EwEbOs6UQwGX3tH1 cuAQ== X-Gm-Message-State: AMke39kq34g9rw1M/pAaoOmCG7UhZX247OP1Jd7dhE3EIVH9deG5muMcJpsIyIGCzDzJtA== X-Received: by 10.28.74.69 with SMTP id x66mr10457322wma.124.1489069901278; Thu, 09 Mar 2017 06:31:41 -0800 (PST) Received: from development1.visionsystems.de (mail.visionsystems.de. [213.209.99.202]) by smtp.gmail.com with ESMTPSA id 94sm8427744wrl.50.2017.03.09.06.31.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Mar 2017 06:31:40 -0800 (PST) From: yegorslists@googlemail.com To: linux-input@vger.kernel.org Cc: dmitry.torokhov@gmail.com, lee.jones@linaro.org, robh@kernel.org, mark.rutland@arm.com, andrej.skvortzov@gmail.com, nsekhar@ti.com, khilman@baylibre.com, Yegor Yefremov Subject: [PATCH v2 2/3] tps6507x-ts: add DT support Date: Thu, 9 Mar 2017 15:31:08 +0100 Message-Id: <1489069869-3849-3-git-send-email-yegorslists@googlemail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1489069869-3849-1-git-send-email-yegorslists@googlemail.com> References: <1489069869-3849-1-git-send-email-yegorslists@googlemail.com> 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 From: Yegor Yefremov This patch adds support for DT to tps6507x-ts driver. Signed-off-by: Yegor Yefremov --- drivers/input/touchscreen/tps6507x-ts.c | 40 ++++++++++----------------------- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/input/touchscreen/tps6507x-ts.c b/drivers/input/touchscreen/tps6507x-ts.c index fbaa2f68..502ed0c 100644 --- a/drivers/input/touchscreen/tps6507x-ts.c +++ b/drivers/input/touchscreen/tps6507x-ts.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #define TSC_DEFAULT_POLL_PERIOD 30 /* ms */ #define TPS_DEFAULT_MIN_PRESSURE 0x30 @@ -202,30 +204,11 @@ static void tps6507x_ts_poll(struct input_polled_dev *poll_dev) static int tps6507x_ts_probe(struct platform_device *pdev) { struct tps6507x_dev *tps6507x_dev = dev_get_drvdata(pdev->dev.parent); - const struct tps6507x_board *tps_board; - const struct touchscreen_init_data *init_data; struct tps6507x_ts *tsc; struct input_polled_dev *poll_dev; struct input_dev *input_dev; int error; - /* - * tps_board points to pmic related constants - * coming from the board-evm file. - */ - tps_board = dev_get_platdata(tps6507x_dev->dev); - if (!tps_board) { - dev_err(tps6507x_dev->dev, - "Could not find tps6507x platform data\n"); - return -ENODEV; - } - - /* - * init_data points to array of regulator_init structures - * coming from the board-evm file. - */ - init_data = tps_board->tps6507x_ts_init_data; - tsc = devm_kzalloc(&pdev->dev, sizeof(struct tps6507x_ts), GFP_KERNEL); if (!tsc) { dev_err(tps6507x_dev->dev, "failed to allocate driver data\n"); @@ -234,8 +217,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev) tsc->mfd = tps6507x_dev; tsc->dev = tps6507x_dev->dev; - tsc->min_pressure = init_data ? - init_data->min_pressure : TPS_DEFAULT_MIN_PRESSURE; snprintf(tsc->phys, sizeof(tsc->phys), "%s/input0", dev_name(tsc->dev)); @@ -250,8 +231,6 @@ static int tps6507x_ts_probe(struct platform_device *pdev) poll_dev->private = tsc; poll_dev->poll = tps6507x_ts_poll; - poll_dev->poll_interval = init_data ? - init_data->poll_period : TSC_DEFAULT_POLL_PERIOD; input_dev = poll_dev->input; input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); @@ -265,11 +244,16 @@ static int tps6507x_ts_probe(struct platform_device *pdev) input_dev->phys = tsc->phys; input_dev->dev.parent = tsc->dev; input_dev->id.bustype = BUS_I2C; - if (init_data) { - input_dev->id.vendor = init_data->vendor; - input_dev->id.product = init_data->product; - input_dev->id.version = init_data->version; - } + input_dev->id.vendor = 0; + input_dev->id.product = 65070; + input_dev->id.version = 0x100; + + tsc->poll_dev->poll_interval = TSC_DEFAULT_POLL_PERIOD; + tsc->min_pressure = TPS_DEFAULT_MIN_PRESSURE; + device_property_read_u32_array(tsc->dev, "ti,poll-period", + &tsc->poll_dev->poll_interval, 1); + device_property_read_u16_array(tsc->dev, "ti,min-pressure", + &tsc->min_pressure, 1); error = tps6507x_adc_standby(tsc); if (error)