From patchwork Sat Apr 4 00:49:56 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 46773 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F1FD6215B7 for ; Sat, 4 Apr 2015 00:50:04 +0000 (UTC) Received: by wixm2 with SMTP id m2sf26752441wix.0 for ; Fri, 03 Apr 2015 17:50:04 -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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=yjEaiktfMAcOHWRSc9jJcMcmUVBRt3NDhvetUbZ4egY=; b=mN7TL+rutRkX+OVtBBfpIwCcuWxUh8wTFrc0t75NOzgjNKBlyFkyCxAskFSA7fI0mO eCU4aS/A76T9QkjAmUuflqOAwW0r1U6fiVAZp8SWdyblz3nePogEfjFEMYcjVxJbnli6 eE0aWiWh6PgE+H6cRR497VxH8p2nmDP7Us1R1KzizXylq5FtvuCWZOcSbzz8GhSDdMsP t1H9g3UjBXEsBg4iziUqmbX60kX6gmmaXSWFJO/Zs/B3yzHNwd66aTDs3lDwk9acYfbM zX0b0AcYas9TJLv5e3WkblnFcmAe824ho//gJsawW2IcEn7u942fSgsd0qiByRPovb91 uE0w== X-Gm-Message-State: ALoCoQk3VUFKqH3nOZN9sll1qbgLFxTTt/0/3zRO+YSRWouxXTqW9w+vzdnQK4iuZRuDoI6mUl3z X-Received: by 10.152.88.73 with SMTP id be9mr1114782lab.2.1428108603999; Fri, 03 Apr 2015 17:50:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.21.199 with SMTP id x7ls393688lae.0.gmail; Fri, 03 Apr 2015 17:50:03 -0700 (PDT) X-Received: by 10.112.118.73 with SMTP id kk9mr4166261lbb.3.1428108603862; Fri, 03 Apr 2015 17:50:03 -0700 (PDT) Received: from mail-lb0-f178.google.com (mail-lb0-f178.google.com. [209.85.217.178]) by mx.google.com with ESMTPS id 2si7831179lap.120.2015.04.03.17.50.03 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 17:50:03 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.178 as permitted sender) client-ip=209.85.217.178; Received: by lboc7 with SMTP id c7so86902695lbo.1 for ; Fri, 03 Apr 2015 17:50:03 -0700 (PDT) X-Received: by 10.152.4.104 with SMTP id j8mr4133167laj.72.1428108603421; Fri, 03 Apr 2015 17:50:03 -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.57.201 with SMTP id k9csp2217187lbq; Fri, 3 Apr 2015 17:50:02 -0700 (PDT) X-Received: by 10.68.113.226 with SMTP id jb2mr8213311pbb.32.1428108601460; Fri, 03 Apr 2015 17:50:01 -0700 (PDT) Received: from mail-pd0-f174.google.com (mail-pd0-f174.google.com. [209.85.192.174]) by mx.google.com with ESMTPS id zs6si534212pbc.236.2015.04.03.17.50.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 17:50:01 -0700 (PDT) Received-SPF: pass (google.com: domain of john.stultz@linaro.org designates 209.85.192.174 as permitted sender) client-ip=209.85.192.174; Received: by pddn5 with SMTP id n5so137025521pdd.2 for ; Fri, 03 Apr 2015 17:50:00 -0700 (PDT) X-Received: by 10.68.88.196 with SMTP id bi4mr8308237pbb.130.1428108600483; Fri, 03 Apr 2015 17:50:00 -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 qb7sm9207245pbc.43.2015.04.03.17.49.59 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 03 Apr 2015 17:49:59 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: Mark Greer , Alex Elder , Greg Kroah-Hartman , "Mark A. Greer" , John Stultz Subject: [PATCH 1/2] greybus: Initial I2S definitions Date: Fri, 3 Apr 2015 17:49:56 -0700 Message-Id: <1428108597-22450-1-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.9.1 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.178 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: , From: Mark Greer These are definitions from Mark that I've consolidated into one header file. I'd like to get these merged at some point soon, so the audio driver and gbsim work can avoid having out-of-tree dependencies. Cc: mark greer Cc: Alex Elder Cc: Greg Kroah-Hartman Reviewed-by: Alex Elder Signed-off-by: Mark A. Greer Signed-off-by: John Stultz --- It would be nice to get this merged! -john greybus_manifest.h | 4 +- i2s.h | 145 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+), 1 deletion(-) create mode 100644 i2s.h diff --git a/greybus_manifest.h b/greybus_manifest.h index 4b2cf92..9ab1c82 100644 --- a/greybus_manifest.h +++ b/greybus_manifest.h @@ -35,7 +35,7 @@ enum greybus_protocol { GREYBUS_PROTOCOL_SDIO = 0x07, GREYBUS_PROTOCOL_BATTERY = 0x08, GREYBUS_PROTOCOL_PWM = 0x09, - GREYBUS_PROTOCOL_I2S = 0x0a, + GREYBUS_PROTOCOL_I2S_MGMT = 0x0a, GREYBUS_PROTOCOL_SPI = 0x0b, GREYBUS_PROTOCOL_DISPLAY = 0x0c, GREYBUS_PROTOCOL_CAMERA = 0x0d, @@ -43,6 +43,8 @@ enum greybus_protocol { GREYBUS_PROTOCOL_LED = 0x0f, GREYBUS_PROTOCOL_VIBRATOR = 0x10, GREYBUS_PROTOCOL_LOOPBACK = 0x11, + GREYBUS_PROTOCOL_I2S_RECEIVER = 0x12, + GREYBUS_PROTOCOL_I2S_TRANSMITTER = 0x13, /* ... */ GREYBUS_PROTOCOL_VENDOR = 0xff, }; diff --git a/i2s.h b/i2s.h new file mode 100644 index 0000000..5c42756 --- /dev/null +++ b/i2s.h @@ -0,0 +1,145 @@ +#ifndef __GB_I2S_H__ +#define __GB_I2S_H__ + +#ifndef BIT +#define BIT(n) (1UL << (n)) +#endif + +#define GB_I2S_MGMT_TYPE_PROTOCOL_VERSION 0x01 +#define GB_I2S_MGMT_TYPE_GET_SUPPORTED_CONFIGURATIONS 0x02 +#define GB_I2S_MGMT_TYPE_SET_CONFIGURATION 0x03 +#define GB_I2S_MGMT_TYPE_SET_SAMPLES_PER_MESSAGE 0x04 +#define GB_I2S_MGMT_TYPE_GET_PROCESSING_DELAY 0x05 +#define GB_I2S_MGMT_TYPE_SET_START_DELAY 0x06 +#define GB_I2S_MGMT_TYPE_ACTIVATE_CPORT 0x07 +#define GB_I2S_MGMT_TYPE_DEACTIVATE_CPORT 0x08 +#define GB_I2S_MGMT_TYPE_REPORT_EVENT 0x09 + +#define GB_I2S_MGMT_BYTE_ORDER_NA BIT(0) +#define GB_I2S_MGMT_BYTE_ORDER_BE BIT(1) +#define GB_I2S_MGMT_BYTE_ORDER_LE BIT(2) + +#define GB_I2S_MGMT_SPATIAL_LOCATION_FL BIT(0) +#define GB_I2S_MGMT_SPATIAL_LOCATION_FR BIT(1) +#define GB_I2S_MGMT_SPATIAL_LOCATION_FC BIT(2) +#define GB_I2S_MGMT_SPATIAL_LOCATION_LFE BIT(3) +#define GB_I2S_MGMT_SPATIAL_LOCATION_BL BIT(4) +#define GB_I2S_MGMT_SPATIAL_LOCATION_BR BIT(5) +#define GB_I2S_MGMT_SPATIAL_LOCATION_FLC BIT(6) +#define GB_I2S_MGMT_SPATIAL_LOCATION_FRC BIT(7) +#define GB_I2S_MGMT_SPATIAL_LOCATION_C BIT(8) /* BC in USB */ +#define GB_I2S_MGMT_SPATIAL_LOCATION_SL BIT(9) +#define GB_I2S_MGMT_SPATIAL_LOCATION_SR BIT(10) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TC BIT(11) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TFL BIT(12) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TFC BIT(13) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TFR BIT(14) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TBL BIT(15) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TBC BIT(16) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TBR BIT(17) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TFLC BIT(18) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TFRC BIT(19) +#define GB_I2S_MGMT_SPATIAL_LOCATION_LLFE BIT(20) +#define GB_I2S_MGMT_SPATIAL_LOCATION_RLFE BIT(21) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TSL BIT(22) +#define GB_I2S_MGMT_SPATIAL_LOCATION_TSR BIT(23) +#define GB_I2S_MGMT_SPATIAL_LOCATION_BC BIT(24) +#define GB_I2S_MGMT_SPATIAL_LOCATION_BLC BIT(25) +#define GB_I2S_MGMT_SPATIAL_LOCATION_BRC BIT(26) +#define GB_I2S_MGMT_SPATIAL_LOCATION_RD BIT(31) + +#define GB_I2S_MGMT_PROTOCOL_PCM BIT(0) +#define GB_I2S_MGMT_PROTOCOL_I2S BIT(1) +#define GB_I2S_MGMT_PROTOCOL_LR_STEREO BIT(2) + +#define GB_I2S_MGMT_ROLE_MASTER BIT(0) +#define GB_I2S_MGMT_ROLE_SLAVE BIT(1) + +#define GB_I2S_MGMT_POLARITY_NORMAL BIT(0) +#define GB_I2S_MGMT_POLARITY_REVERSED BIT(1) + +#define GB_I2S_MGMT_EDGE_RISING BIT(0) +#define GB_I2S_MGMT_EDGE_FALLING BIT(1) + +#define GB_I2S_MGMT_EVENT_UNSPECIFIED 0x1 +#define GB_I2S_MGMT_EVENT_HALT 0x2 +#define GB_I2S_MGMT_EVENT_INTERNAL_ERROR 0x3 +#define GB_I2S_MGMT_EVENT_PROTOCOL_ERROR 0x4 +#define GB_I2S_MGMT_EVENT_FAILURE 0x5 +#define GB_I2S_MGMT_EVENT_OUT_OF_SEQUENCE 0x6 +#define GB_I2S_MGMT_EVENT_UNDERRUN 0x7 +#define GB_I2S_MGMT_EVENT_OVERRUN 0x8 +#define GB_I2S_MGMT_EVENT_CLOCKING 0x9 +#define GB_I2S_MGMT_EVENT_DATA_LEN 0xa + +struct gb_i2s_mgmt_configuration { + __le32 sample_frequency; + __u8 num_channels; + __u8 bytes_per_channel; + __u8 byte_order; + __u8 pad; + __le32 spatial_locations; + __le32 ll_protocol; + __u8 ll_bclk_role; + __u8 ll_wclk_role; + __u8 ll_wclk_polarity; + __u8 ll_wclk_change_edge; + __u8 ll_wclk_tx_edge; + __u8 ll_wclk_rx_edge; + __u8 ll_data_offset; + __u8 ll_pad; +}; + +/* get supported configurations request has no payload */ +struct gb_i2s_mgmt_get_supported_configurations_response { + __u8 config_count; + __u8 pad[3]; + struct gb_i2s_mgmt_configuration config[0]; +}; + +struct gb_i2s_mgmt_set_configuration_request { + struct gb_i2s_mgmt_configuration config; +}; +/* set configuration response has no payload */ + +struct gb_i2s_mgmt_set_samples_per_message_request { + __le16 samples_per_message; +}; +/* set samples per message response has no payload */ + +/* get processing request delay has no payload */ +struct gb_i2s_mgmt_get_processing_delay_response { + __le32 microseconds; +}; + +struct gb_i2s_mgmt_set_start_delay_request { + __le32 microseconds; +}; +/* set start delay response has no payload */ + +struct gb_i2s_mgmt_activate_cport_request { + __le16 cport; +}; +/* activate cport response has no payload */ + +struct gb_i2s_mgmt_deactivate_cport_request { + __le16 cport; +}; +/* deactivate cport response has no payload */ + +struct gb_i2s_mgmt_report_event_request { + __u8 event; +}; +/* report event response has no payload */ + +#define GB_I2S_DATA_TYPE_PROTOCOL_VERSION 0x01 +#define GB_I2S_DATA_TYPE_SEND_DATA 0x02 + +struct gb_i2s_send_data_request { + __le32 sample_number; + __le32 size; + __u8 data[0]; +}; +/* send data has no response at all */ + +#endif /* __GB_I2S_H__ */