From patchwork Mon Oct 19 03:17:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 532091 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id D72A21402B0 for ; Mon, 19 Oct 2015 14:18:57 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b=dt7xzt20; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 32FDA4B861; Mon, 19 Oct 2015 05:18:44 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Pyyf7908Imh4; Mon, 19 Oct 2015 05:18:43 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 308674B7BD; Mon, 19 Oct 2015 05:18:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 4C1274B716 for ; Mon, 19 Oct 2015 05:17:53 +0200 (CEST) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id oripxzHWYo3W for ; Mon, 19 Oct 2015 05:17:53 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-ig0-f171.google.com (mail-ig0-f171.google.com [209.85.213.171]) by theia.denx.de (Postfix) with ESMTPS id 6CEFF4B6DE for ; Mon, 19 Oct 2015 05:17:47 +0200 (CEST) Received: by igbni9 with SMTP id ni9so46151967igb.1 for ; Sun, 18 Oct 2015 20:17:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=krK+d3PBEINQ8+B8F8SVc7GYGxVFzWDFPt/RQMXjSSM=; b=dt7xzt20sWldg+OH09Osu9Ib5b3snGj3Lp/1damSAAPwUTJGHoeydwHOAlE5S6oHXA xykpKadluRuvzy6m6BBY3ffDU0lhOiaLjM9GTpr8YyUngE6apvxbRIMpDYVcof3CS3Ch JRfmgn/3LUlq1RZbXEPKAMDc5MJC5PdMUZPxaV/Q5GtXy2LQ0SPMcX0FnzEvR1F/DGrR sG716InbgCy95Cjw9BNa9hhSD12Nw1YW+mlERMRvU4/vwBHjsuBGk7YERUpQETQu6ufG wEiqkSlqe6WPpQv6kiuBAR/UylHqxDKsTsYxlNWZ5bmNn9QhggaUaCd4vE99LonA77yc Oljg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=krK+d3PBEINQ8+B8F8SVc7GYGxVFzWDFPt/RQMXjSSM=; b=GQlHuv3r/UsATEVXAjR3gKZD66VWRz1HqlNAK24k/GVACb6jIC63IB2Gl4aDWw6nL8 zufpPg6Cy58w4G75hLffRz9qAscxLHBTdsusVKoqzUe4yhJtbglWYLgBAi0B9fic4SEr 2O2WcolRubn4CkVtqbVll0LaQfAh3cEFuxW7Ioby99aGkOrs9cnJGxCIDXAtehR4wk6w BABmGRpIM7qOiDJQCiq2itkwnNr7eT6tTtuuB6bEPG9ZbxyDpNx6Kncv5dnOpg8lVhXw T60Rm+G5cir18UUJ8G6xMrct67UXyVMIoBQzb6+GtORNuY1FCxRHozd9ReqtMSgTP/qm 2NQw== X-Gm-Message-State: ALoCoQmn5zUKWjFeCVvWic3DXgP9VhimAHlBZVFLjsVGt2AeJJxe/iQjwWVt0itpaavSTN9AQptZ X-Received: by 10.51.17.39 with SMTP id gb7mr16125297igd.56.1445224666378; Sun, 18 Oct 2015 20:17:46 -0700 (PDT) Received: from kaki.bld.corp.google.com ([2620:0:1005:1100:5443:a37f:acd4:57b0]) by smtp.gmail.com with ESMTPSA id n68sm13322541ion.26.2015.10.18.20.17.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 18 Oct 2015 20:17:44 -0700 (PDT) Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id BC8FD22135D; Sun, 18 Oct 2015 21:17:43 -0600 (MDT) From: Simon Glass To: U-Boot Mailing List Date: Sun, 18 Oct 2015 21:17:14 -0600 Message-Id: <1445224657-20622-6-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.6.0.rc2.230.g3dd15c0 In-Reply-To: <1445224657-20622-1-git-send-email-sjg@chromium.org> References: <1445224657-20622-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH v2 05/28] cros_ec: Use udevice instead of cros_ec_dev for keyboard functions X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" In preparation for converting the cros_ec keyboard driver to driver model, adjust the cros_ec functions it will use to use a normal struct udevice. Signed-off-by: Simon Glass --- Changes in v2: None drivers/input/cros_ec_keyb.c | 4 ++-- drivers/misc/cros_ec.c | 14 +++++++++----- include/cros_ec.h | 4 ++-- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/input/cros_ec_keyb.c b/drivers/input/cros_ec_keyb.c index eaab86f..88397b0 100644 --- a/drivers/input/cros_ec_keyb.c +++ b/drivers/input/cros_ec_keyb.c @@ -54,7 +54,7 @@ static int check_for_keys(struct keyb *config, unsigned int row, col, bit, data; int num_keys; - if (cros_ec_scan_keyboard(config->dev, &scan)) { + if (cros_ec_scan_keyboard(config->dev->dev, &scan)) { debug("%s: keyboard scan failed\n", __func__); return -EIO; } @@ -139,7 +139,7 @@ int cros_ec_kbc_check(struct input_config *input) * may return 0 before all keys have been read from the EC. */ do { - irq_pending = cros_ec_interrupt_pending(config.dev); + irq_pending = cros_ec_interrupt_pending(config.dev->dev); if (irq_pending) { num_keys = check_for_keys(&config, keys, KBC_MAX_KEYS, &same); diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c index ba36795..e3229ef 100644 --- a/drivers/misc/cros_ec.c +++ b/drivers/misc/cros_ec.c @@ -358,9 +358,11 @@ static int ec_command(struct cros_ec_dev *dev, uint8_t cmd, int cmd_version, return len; } -int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan) +int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan) { - if (ec_command(dev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan, + struct cros_ec_dev *cdev = dev_get_uclass_priv(dev); + + if (ec_command(cdev, EC_CMD_MKBP_STATE, 0, NULL, 0, scan, sizeof(scan->data)) != sizeof(scan->data)) return -1; @@ -549,13 +551,15 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd, return 0; } -int cros_ec_interrupt_pending(struct cros_ec_dev *dev) +int cros_ec_interrupt_pending(struct udevice *dev) { + struct cros_ec_dev *cdev = dev_get_uclass_priv(dev); + /* no interrupt support : always poll */ - if (!dm_gpio_is_valid(&dev->ec_int)) + if (!dm_gpio_is_valid(&cdev->ec_int)) return -ENOENT; - return dm_gpio_get_value(&dev->ec_int); + return dm_gpio_get_value(&cdev->ec_int); } int cros_ec_info(struct cros_ec_dev *dev, struct ec_response_mkbp_info *info) diff --git a/include/cros_ec.h b/include/cros_ec.h index b926934..5fa5f6f 100644 --- a/include/cros_ec.h +++ b/include/cros_ec.h @@ -81,7 +81,7 @@ int cros_ec_read_id(struct cros_ec_dev *dev, char *id, int maxlen); * @param scan Place to put the scan results * @return 0 if ok, -1 on error */ -int cros_ec_scan_keyboard(struct cros_ec_dev *dev, struct mbkp_keyscan *scan); +int cros_ec_scan_keyboard(struct udevice *dev, struct mbkp_keyscan *scan); /** * Read which image is currently running on the CROS-EC device. @@ -125,7 +125,7 @@ int cros_ec_reboot(struct cros_ec_dev *dev, enum ec_reboot_cmd cmd, * @param dev CROS-EC device * @return 0 if no interrupt is pending */ -int cros_ec_interrupt_pending(struct cros_ec_dev *dev); +int cros_ec_interrupt_pending(struct udevice *dev); enum { CROS_EC_OK,