From patchwork Thu Mar 19 14:52:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 46034 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB20A21515 for ; Thu, 19 Mar 2015 14:53:19 +0000 (UTC) Received: by wevm14 with SMTP id m14sf5721443wev.0 for ; Thu, 19 Mar 2015 07:53:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=WnE054Dv/2RT/09Caldn6L7ULFXl9Jj2IZSrhASl/w0=; b=dhnH5milCz/ZisPOSXr0ThN4rZ8WhwNsu6gQi3Ux9kjLCJB6sLmNe3pZaeopiI6nkv /QOSiAcHaJMqnkozY6+E/Z5jiDK4mO0cFJ0ENVulRcICnsXo4jPvFciIY1DVLNNgtikQ m+kKwGd6CtXahWDazQHr3ywuVnjsY4dje5J6mXYKrOPo4KV6gJXopzWIX0MDMlsnMnXX H4+uCplb32sTL1BZhUCBm9ZamVBYFiw7xt4+2KliejPAOcEGKMVdGKibd5WUwK2DGMyp L490bPswkBZTBmsMh66UmowMioslF2R0Ofmo+Fzc8KPsfCWUGt0TH5v8tctN6pyJnpOT cQOA== X-Gm-Message-State: ALoCoQlV1QCaM5vq+LYHI1nvARVwbPja/4rw+l5ou0joDnyTwW9KjG7TqxyZZoSaB3G4V6VAEDS4 X-Received: by 10.180.150.115 with SMTP id uh19mr1824119wib.7.1426776799268; Thu, 19 Mar 2015 07:53:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.234.236 with SMTP id uh12ls309523lac.54.gmail; Thu, 19 Mar 2015 07:53:18 -0700 (PDT) X-Received: by 10.152.87.144 with SMTP id ay16mr13752274lab.10.1426776798928; Thu, 19 Mar 2015 07:53:18 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id aa5si1169905lbc.64.2015.03.19.07.53.18 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:53:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbcgn8 with SMTP id gn8so54543648lbc.2 for ; Thu, 19 Mar 2015 07:53:18 -0700 (PDT) X-Received: by 10.152.5.194 with SMTP id u2mr69359204lau.88.1426776798691; Thu, 19 Mar 2015 07:53:18 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.35.133 with SMTP id h5csp438494lbj; Thu, 19 Mar 2015 07:53:17 -0700 (PDT) X-Received: by 10.70.130.97 with SMTP id od1mr61379056pdb.0.1426776796644; Thu, 19 Mar 2015 07:53:16 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bs5si3383256pdb.127.2015.03.19.07.53.15 for ; Thu, 19 Mar 2015 07:53:16 -0700 (PDT) Received-SPF: none (google.com: linux-input-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752916AbbCSOxI (ORCPT ); Thu, 19 Mar 2015 10:53:08 -0400 Received: from mail-la0-f44.google.com ([209.85.215.44]:34007 "EHLO mail-la0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752212AbbCSOxF (ORCPT ); Thu, 19 Mar 2015 10:53:05 -0400 Received: by lagg8 with SMTP id g8so64207581lag.1 for ; Thu, 19 Mar 2015 07:53:03 -0700 (PDT) X-Received: by 10.112.126.199 with SMTP id na7mr17308674lbb.114.1426776783363; Thu, 19 Mar 2015 07:53:03 -0700 (PDT) Received: from localhost.localdomain ([85.235.11.236]) by mx.google.com with ESMTPSA id xq2sm328042lbb.49.2015.03.19.07.53.01 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Mar 2015 07:53:02 -0700 (PDT) From: Linus Walleij To: Samuel Ortiz , Lee Jones , Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-input@vger.kernel.org, Linus Walleij Subject: [PATCH 1/2] input: keypad: tc3589x: localize platform data Date: Thu, 19 Mar 2015 15:52:44 +0100 Message-Id: <1426776765-18812-2-git-send-email-linus.walleij@linaro.org> X-Mailer: git-send-email 1.9.3 In-Reply-To: <1426776765-18812-1-git-send-email-linus.walleij@linaro.org> References: <1426776765-18812-1-git-send-email-linus.walleij@linaro.org> Sender: linux-input-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: linus.walleij@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , This driver can only get its platform data from the device tree, and all platforms using it does that. Localize the platform data for the keypad. A later patch will enforce the device tree / OF dependence. Cc: Dmitry Torokhov Cc: Lee Jones Signed-off-by: Linus Walleij Acked-by: Lee Jones --- Dmitry it would be great if you could ACK this patch so Lee can take it with the other patch through MFD. --- drivers/input/keyboard/tc3589x-keypad.c | 49 ++++++++++++++++++++++----------- include/linux/mfd/tc3589x.h | 23 ---------------- 2 files changed, 33 insertions(+), 39 deletions(-) diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c index 563932500ff1..0ccc7de9b59d 100644 --- a/drivers/input/keyboard/tc3589x-keypad.c +++ b/drivers/input/keyboard/tc3589x-keypad.c @@ -70,6 +70,28 @@ #define TC3589x_KBD_INT_CLR 0x1 /** + * struct tc35893_keypad_platform_data - platform specific keypad data + * @keymap_data: matrix scan code table for keycodes + * @krow: mask for available rows, value is 0xFF + * @kcol: mask for available columns, value is 0xFF + * @debounce_period: platform specific debounce time + * @settle_time: platform specific settle down time + * @irqtype: type of interrupt, falling or rising edge + * @enable_wakeup: specifies if keypad event can wake up system from sleep + * @no_autorepeat: flag for auto repetition + */ +struct tc3589x_keypad_platform_data { + const struct matrix_keymap_data *keymap_data; + u8 krow; + u8 kcol; + u8 debounce_period; + u8 settle_time; + unsigned long irqtype; + bool enable_wakeup; + bool no_autorepeat; +}; + +/** * struct tc_keypad - data structure used by keypad driver * @tc3589x: pointer to tc35893 * @input: pointer to input device object @@ -360,23 +382,19 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) struct tc3589x *tc3589x = dev_get_drvdata(pdev->dev.parent); struct tc_keypad *keypad; struct input_dev *input; - const struct tc3589x_keypad_platform_data *plat; int error, irq; - plat = tc3589x->pdata->keypad; - if (!plat) { - plat = tc3589x_keypad_of_probe(&pdev->dev); - if (IS_ERR(plat)) { - dev_err(&pdev->dev, "invalid keypad platform data\n"); - return PTR_ERR(plat); - } - } - irq = platform_get_irq(pdev, 0); if (irq < 0) return irq; keypad = kzalloc(sizeof(struct tc_keypad), GFP_KERNEL); + keypad->board = tc3589x_keypad_of_probe(&pdev->dev); + if (IS_ERR(keypad->board)) { + dev_err(&pdev->dev, "invalid keypad platform data\n"); + return PTR_ERR(keypad->board); + } + input = input_allocate_device(); if (!keypad || !input) { dev_err(&pdev->dev, "failed to allocate keypad memory\n"); @@ -384,7 +402,6 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) goto err_free_mem; } - keypad->board = plat; keypad->input = input; keypad->tc3589x = tc3589x; @@ -395,7 +412,7 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) input->open = tc3589x_keypad_open; input->close = tc3589x_keypad_close; - error = matrix_keypad_build_keymap(plat->keymap_data, NULL, + error = matrix_keypad_build_keymap(keypad->board->keymap_data, NULL, TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL, NULL, input); if (error) { @@ -406,13 +423,13 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) keypad->keymap = input->keycode; input_set_capability(input, EV_MSC, MSC_SCAN); - if (!plat->no_autorepeat) + if (!keypad->board->no_autorepeat) __set_bit(EV_REP, input->evbit); input_set_drvdata(input, keypad); error = request_threaded_irq(irq, NULL, tc3589x_keypad_irq, - plat->irqtype | IRQF_ONESHOT, + keypad->board->irqtype | IRQF_ONESHOT, "tc3589x-keypad", keypad); if (error < 0) { dev_err(&pdev->dev, @@ -428,8 +445,8 @@ static int tc3589x_keypad_probe(struct platform_device *pdev) } /* let platform decide if keypad is a wakeup source or not */ - device_init_wakeup(&pdev->dev, plat->enable_wakeup); - device_set_wakeup_capable(&pdev->dev, plat->enable_wakeup); + device_init_wakeup(&pdev->dev, keypad->board->enable_wakeup); + device_set_wakeup_capable(&pdev->dev, keypad->board->enable_wakeup); platform_set_drvdata(pdev, keypad); diff --git a/include/linux/mfd/tc3589x.h b/include/linux/mfd/tc3589x.h index c203c9c56776..468c31a27fcf 100644 --- a/include/linux/mfd/tc3589x.h +++ b/include/linux/mfd/tc3589x.h @@ -140,36 +140,13 @@ extern int tc3589x_set_bits(struct tc3589x *tc3589x, u8 reg, u8 mask, u8 val); #define TC_KPD_DEBOUNCE_PERIOD 0xA3 #define TC_KPD_SETTLE_TIME 0xA3 -/** - * struct tc35893_platform_data - data structure for platform specific data - * @keymap_data: matrix scan code table for keycodes - * @krow: mask for available rows, value is 0xFF - * @kcol: mask for available columns, value is 0xFF - * @debounce_period: platform specific debounce time - * @settle_time: platform specific settle down time - * @irqtype: type of interrupt, falling or rising edge - * @enable_wakeup: specifies if keypad event can wake up system from sleep - * @no_autorepeat: flag for auto repetition - */ -struct tc3589x_keypad_platform_data { - const struct matrix_keymap_data *keymap_data; - u8 krow; - u8 kcol; - u8 debounce_period; - u8 settle_time; - unsigned long irqtype; - bool enable_wakeup; - bool no_autorepeat; -}; /** * struct tc3589x_platform_data - TC3589x platform data * @block: bitmask of blocks to enable (use TC3589x_BLOCK_*) - * @keypad: keypad-specific platform data */ struct tc3589x_platform_data { unsigned int block; - const struct tc3589x_keypad_platform_data *keypad; }; #endif