From patchwork Thu Apr 9 19:00:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46979 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B19F121416 for ; Thu, 9 Apr 2015 19:00:59 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf29168178lab.1 for ; Thu, 09 Apr 2015 12:00:58 -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=Vn3cqw9jD56gqn47ytYmbPR3Zw5tdZ6jI4BY1/C2YFc=; b=ShbW0kSGrgA0ocSulHwejMFLTS3vCXAXtwfUsGxnS/y4DDsbULFRntiInztQKI22Zq sOTr6AMI8rNAlh4FH1tAtVZcAaefTibwmL2z0VleQ68Bmnu6RfGXI6VfXe+J3WaLou3s yEncQ+o078j7QiD7/YTJmYom6PN1yzOfVkjaeziGwctCigfAzxvn2+A7Air8bKt8lj0d dGRPgFOTsp4kA4e8rRFvjfizV2SRfQOmofZRP9PdXEhvZPsKXWQgvxVd7W9I6f3oJM0X cZwrmMUCBhRsHuiIVtXqvpkAmk1Y+HVsszlDRjOB3OtI0epwz6FTPovsjNEBGrURT+6B 92NQ== X-Gm-Message-State: ALoCoQkeMMi5MgZ12+nkie1JdqpJzqIQxZ9u9DM1Va3raY1goJoDROIN/xH1O++UxeG6r4cy7Vzo X-Received: by 10.180.150.115 with SMTP id uh19mr864152wib.7.1428606058680; Thu, 09 Apr 2015 12:00:58 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.178.195 with SMTP id da3ls366575lac.30.gmail; Thu, 09 Apr 2015 12:00:58 -0700 (PDT) X-Received: by 10.112.219.135 with SMTP id po7mr28959125lbc.111.1428606058453; Thu, 09 Apr 2015 12:00:58 -0700 (PDT) Received: from mail-lb0-f176.google.com (mail-lb0-f176.google.com. [209.85.217.176]) by mx.google.com with ESMTPS id m10si11843054laj.124.2015.04.09.12.00.58 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 12:00:58 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.176 as permitted sender) client-ip=209.85.217.176; Received: by lbbuc2 with SMTP id uc2so94910870lbb.2 for ; Thu, 09 Apr 2015 12:00:58 -0700 (PDT) X-Received: by 10.152.116.11 with SMTP id js11mr5779967lab.106.1428606058350; Thu, 09 Apr 2015 12:00:58 -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 l1csp651346lbt; Thu, 9 Apr 2015 12:00:57 -0700 (PDT) X-Received: by 10.66.161.161 with SMTP id xt1mr58534427pab.35.1428606056277; Thu, 09 Apr 2015 12:00:56 -0700 (PDT) Received: from mail-pa0-f44.google.com (mail-pa0-f44.google.com. [209.85.220.44]) by mx.google.com with ESMTPS id g12si22741472pat.50.2015.04.09.12.00.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 09 Apr 2015 12:00:56 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.220.44 as permitted sender) client-ip=209.85.220.44; Received: by paboj16 with SMTP id oj16so158605906pab.0 for ; Thu, 09 Apr 2015 12:00:55 -0700 (PDT) X-Received: by 10.66.236.167 with SMTP id uv7mr49719647pac.58.1428606055316; Thu, 09 Apr 2015 12:00:55 -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 tm6sm15094989pbc.7.2015.04.09.12.00.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 09 Apr 2015 12:00:54 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: John Stultz , Alex Elder , Greg Kroah-Hartman , Johan Hovold Subject: [PATCH 1/3] greybus: gpio: Split structure definitions into gpio.h Date: Thu, 9 Apr 2015 12:00:45 -0700 Message-Id: <1428606047-23440-2-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1428606047-23440-1-git-send-email-john.stultz@linaro.org> References: <1428606047-23440-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.217.176 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 CC: Johan Hovold 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..659eb4b --- /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 __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__*/