From patchwork Tue Apr 7 01:59:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46798 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 54534214BA for ; Tue, 7 Apr 2015 01:59:48 +0000 (UTC) Received: by wgfh4 with SMTP id h4sf9589049wgf.1 for ; Mon, 06 Apr 2015 18:59:47 -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:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=ebMVfT+epGIS6wQZKC5wBSqCLcSjNU13YjEfGBbY7Xc=; b=ByZt+bCiWDRYWZgEhipfPl0o7R1mflGcgovRm3oU1Co8DNULnE3jJoSPcJYRbbD2mk 6lTbFMKQiCbVLwn4xt5pDndKJ9Y+qIKoK+DCAouvOtt4v3lckTTGghseeAzOnGEe4ZNg OX9Wxggx51jKs1YWYjC7VjoFo3cUgJ32rIJWUq+KqocSnL6ynryEKQ8ZpLL/pRrzApaj slNui5PKCNyl+Xxl6jyL94UmU0GkaBKa2W2On0Ul4+s/Zs3d32kbGCyE/flVlyCY3X/R BHkkP15Hjz2uF48TzIEhpMI/X/XAP4tkquRMdYsJzWdbNV3drigWTHrBy7e9VUkUrffI 9wdg== X-Gm-Message-State: ALoCoQnZW7GU30jr9ELHFOO+NxlE3zEusQXDAGmsFcPfZyy8AqkCIk/9AGRBuBmY5vpZTjnBFXNJ X-Received: by 10.194.161.194 with SMTP id xu2mr3679631wjb.1.1428371987669; Mon, 06 Apr 2015 18:59:47 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.43.41 with SMTP id t9ls530497lal.82.gmail; Mon, 06 Apr 2015 18:59:47 -0700 (PDT) X-Received: by 10.112.124.166 with SMTP id mj6mr15927839lbb.104.1428371987476; Mon, 06 Apr 2015 18:59:47 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id ew9si1208899lac.87.2015.04.06.18.59.47 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 18:59:47 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by lagv1 with SMTP id v1so31720353lag.3 for ; Mon, 06 Apr 2015 18:59:47 -0700 (PDT) X-Received: by 10.112.16.196 with SMTP id i4mr5164032lbd.72.1428371987203; Mon, 06 Apr 2015 18:59:47 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.112.67.65 with SMTP id l1csp144915lbt; Mon, 6 Apr 2015 18:59:46 -0700 (PDT) X-Received: by 10.70.92.132 with SMTP id cm4mr31693957pdb.18.1428371985296; Mon, 06 Apr 2015 18:59:45 -0700 (PDT) Received: from mail-pd0-f181.google.com (mail-pd0-f181.google.com. [209.85.192.181]) by mx.google.com with ESMTPS id eq8si8961332pac.187.2015.04.06.18.59.44 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 06 Apr 2015 18:59:45 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.181 as permitted sender) client-ip=209.85.192.181; Received: by pdbnk13 with SMTP id nk13so62589257pdb.0 for ; Mon, 06 Apr 2015 18:59:44 -0700 (PDT) X-Received: by 10.66.142.134 with SMTP id rw6mr31882866pab.56.1428371984402; Mon, 06 Apr 2015 18:59:44 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id xh3sm6156493pab.25.2015.04.06.18.59.43 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 06 Apr 2015 18:59:43 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: John Stultz , Alex Elder , Greg Kroah-Hartman Subject: [PATCH 1/3] greybus: gpio: Split structure definitions into gpio.h Date: Mon, 6 Apr 2015 18:59:37 -0700 Message-Id: <1428371979-9737-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428371979-9737-1-git-send-email-john.stultz@linaro.org> References: <1428371979-9737-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@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.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , In order to facilitate re-use of the gpio structures, split the definitions out into gpio.h This will be a prereq to sharing these headers w/ gbsim. Cc: Alex Elder Cc: Greg Kroah-Hartman Signed-off-by: John Stultz --- gpio.c | 105 +-------------------------------------------------------- gpio.h | 118 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 119 insertions(+), 104 deletions(-) create mode 100644 gpio.h diff --git a/gpio.c b/gpio.c index 20917bf..941ae80 100644 --- a/gpio.c +++ b/gpio.c @@ -14,6 +14,7 @@ #include #include #include "greybus.h" +#include "gpio.h" struct gb_gpio_line { /* The following has to be an array of line_max entries */ @@ -43,110 +44,6 @@ struct gb_gpio_controller { container_of(chip, struct gb_gpio_controller, chip) #define irq_data_to_gpio_chip(d) (d->domain->host_data) -/* Version of the Greybus GPIO protocol we support */ -#define GB_GPIO_VERSION_MAJOR 0x00 -#define GB_GPIO_VERSION_MINOR 0x01 - -/* Greybus GPIO request types */ -#define GB_GPIO_TYPE_INVALID 0x00 -#define GB_GPIO_TYPE_PROTOCOL_VERSION 0x01 -#define GB_GPIO_TYPE_LINE_COUNT 0x02 -#define GB_GPIO_TYPE_ACTIVATE 0x03 -#define GB_GPIO_TYPE_DEACTIVATE 0x04 -#define GB_GPIO_TYPE_GET_DIRECTION 0x05 -#define GB_GPIO_TYPE_DIRECTION_IN 0x06 -#define GB_GPIO_TYPE_DIRECTION_OUT 0x07 -#define GB_GPIO_TYPE_GET_VALUE 0x08 -#define GB_GPIO_TYPE_SET_VALUE 0x09 -#define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a -#define GB_GPIO_TYPE_IRQ_TYPE 0x0b -#define GB_GPIO_TYPE_IRQ_ACK 0x0c -#define GB_GPIO_TYPE_IRQ_MASK 0x0d -#define GB_GPIO_TYPE_IRQ_UNMASK 0x0e -#define GB_GPIO_TYPE_IRQ_EVENT 0x0f -#define GB_GPIO_TYPE_RESPONSE 0x80 /* OR'd with rest */ - -#define GB_GPIO_DEBOUNCE_USEC_DEFAULT 0 /* microseconds */ - -/* line count request has no payload */ -struct gb_gpio_line_count_response { - __u8 count; -}; - -struct gb_gpio_activate_request { - __u8 which; -}; -/* activate response has no payload */ - -struct gb_gpio_deactivate_request { - __u8 which; -}; -/* deactivate response has no payload */ - -struct gb_gpio_get_direction_request { - __u8 which; -}; -struct gb_gpio_get_direction_response { - __u8 direction; -}; - -struct gb_gpio_direction_in_request { - __u8 which; -}; -/* direction in response has no payload */ - -struct gb_gpio_direction_out_request { - __u8 which; - __u8 value; -}; -/* direction out response has no payload */ - -struct gb_gpio_get_value_request { - __u8 which; -}; -struct gb_gpio_get_value_response { - __u8 value; -}; - -struct gb_gpio_set_value_request { - __u8 which; - __u8 value; -}; -/* set value response has no payload */ - -struct gb_gpio_set_debounce_request { - __u8 which; - __le16 usec __packed; -}; -/* debounce response has no payload */ - -struct gb_gpio_irq_type_request { - __u8 which; - __u8 type; -}; -/* irq type response has no payload */ - -struct gb_gpio_irq_mask_request { - __u8 which; -}; -/* irq mask response has no payload */ - -struct gb_gpio_irq_unmask_request { - __u8 which; -}; -/* irq unmask response has no payload */ - -struct gb_gpio_irq_ack_request { - __u8 which; -}; -/* irq ack response has no payload */ - -/* irq event requests originate on another module and are handled on the AP */ -struct gb_gpio_irq_event_request { - __u8 which; -}; -/* irq event response has no payload */ - /* Define get_version() routine */ define_get_version(gb_gpio_controller, GPIO); diff --git a/gpio.h b/gpio.h new file mode 100644 index 0000000..54a29ab --- /dev/null +++ b/gpio.h @@ -0,0 +1,118 @@ +#ifndef __GB_GPIO_H__ +#define __GB_GPIO_H__ +/* + * GPIO Greybus header. + * + * Copyright 2014 Google Inc. + * Copyright 2014 Linaro Ltd. + * + * Released under the GPLv2 only. + */ + +#include "greybus.h" + +/* Version of the Greybus GPIO protocol we support */ +#define GB_GPIO_VERSION_MAJOR 0x00 +#define GB_GPIO_VERSION_MINOR 0x01 + +/* Greybus GPIO request types */ +#define GB_GPIO_TYPE_INVALID 0x00 +#define GB_GPIO_TYPE_PROTOCOL_VERSION 0x01 +#define GB_GPIO_TYPE_LINE_COUNT 0x02 +#define GB_GPIO_TYPE_ACTIVATE 0x03 +#define GB_GPIO_TYPE_DEACTIVATE 0x04 +#define GB_GPIO_TYPE_GET_DIRECTION 0x05 +#define GB_GPIO_TYPE_DIRECTION_IN 0x06 +#define GB_GPIO_TYPE_DIRECTION_OUT 0x07 +#define GB_GPIO_TYPE_GET_VALUE 0x08 +#define GB_GPIO_TYPE_SET_VALUE 0x09 +#define GB_GPIO_TYPE_SET_DEBOUNCE 0x0a +#define GB_GPIO_TYPE_IRQ_TYPE 0x0b +#define GB_GPIO_TYPE_IRQ_ACK 0x0c +#define GB_GPIO_TYPE_IRQ_MASK 0x0d +#define GB_GPIO_TYPE_IRQ_UNMASK 0x0e +#define GB_GPIO_TYPE_IRQ_EVENT 0x0f +#define GB_GPIO_TYPE_RESPONSE 0x80 /* OR'd with rest */ + +#define GB_GPIO_DEBOUNCE_USEC_DEFAULT 0 /* microseconds */ + +/* line count request has no payload */ +struct gb_gpio_line_count_response { + __u8 count; +}; + +struct gb_gpio_activate_request { + __u8 which; +}; +/* activate response has no payload */ + +struct gb_gpio_deactivate_request { + __u8 which; +}; +/* deactivate response has no payload */ + +struct gb_gpio_get_direction_request { + __u8 which; +}; +struct gb_gpio_get_direction_response { + __u8 direction; +}; + +struct gb_gpio_direction_in_request { + __u8 which; +}; +/* direction in response has no payload */ + +struct gb_gpio_direction_out_request { + __u8 which; + __u8 value; +}; +/* direction out response has no payload */ + +struct gb_gpio_get_value_request { + __u8 which; +}; +struct gb_gpio_get_value_response { + __u8 value; +}; + +struct gb_gpio_set_value_request { + __u8 which; + __u8 value; +}; +/* set value response has no payload */ + +struct gb_gpio_set_debounce_request { + __u8 which; + __le16 usec __attribute__((__packed__)); +}; +/* debounce response has no payload */ + +struct gb_gpio_irq_type_request { + __u8 which; + __u8 type; +}; +/* irq type response has no payload */ + +struct gb_gpio_irq_mask_request { + __u8 which; +}; +/* irq mask response has no payload */ + +struct gb_gpio_irq_unmask_request { + __u8 which; +}; +/* irq unmask response has no payload */ + +struct gb_gpio_irq_ack_request { + __u8 which; +}; +/* irq ack response has no payload */ + +/* irq event requests originate on another module and are handled on the AP */ +struct gb_gpio_irq_event_request { + __u8 which; +}; +/* irq event response has no payload */ + +#endif /*__GB_GPIO_H__*/