From patchwork Tue Mar 31 23: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: 46605 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f70.google.com (mail-la0-f70.google.com [209.85.215.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C091F2159A for ; Tue, 31 Mar 2015 23:50:02 +0000 (UTC) Received: by labgx2 with SMTP id gx2sf2705231lab.1 for ; Tue, 31 Mar 2015 16:50:01 -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=U1zg1H+r/LSSGYIllsq7hO3cNutG4JXJolZYhPLKw4A=; b=VmxF9BD0L+nN2ORIjEy+gqPTYOYtaxU6XK48rUB1+JKOMj+TjFSWm2UT+owBrY1eGH yZY8xJEqbUdNgj5UjvCRfYRWdJxQjlKmjCj2u2LCpDPpy91Tm93UA6B87RFBCerkl40c E51qy18JHFTYA/fSpnZH2Y5eFgU0E3bAaBQOmR+f/B7Y5vonZNkuEjpD7FMtNhaLcom8 bBfOcjBYsh6I34wEo023sO0sXFp/arvuhOqYl8gnCjC+GMgr0es4sjAFR/ru0D5Wk718 KqTBnuHMPtkLHFJkWEAZ+tv8wFNhnw5/XvgDonCWtHB40mE/uuWv2LH2hIR0oTHyKwrV 4hzQ== X-Gm-Message-State: ALoCoQnLeTmzasJuE6EM93wOji+Inj+BTXxSg9pm2JHqfQowUR3IYJCdEQfgLFeIuzpKfn7QerG8 X-Received: by 10.180.90.175 with SMTP id bx15mr1199797wib.3.1427845801703; Tue, 31 Mar 2015 16:50:01 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.129 with SMTP id ay1ls4909lab.61.gmail; Tue, 31 Mar 2015 16:50:01 -0700 (PDT) X-Received: by 10.112.166.36 with SMTP id zd4mr6663224lbb.59.1427845801544; Tue, 31 Mar 2015 16:50:01 -0700 (PDT) Received: from mail-la0-f41.google.com (mail-la0-f41.google.com. [209.85.215.41]) by mx.google.com with ESMTPS id k4si114060lbz.55.2015.03.31.16.50.01 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 16:50:01 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.41 as permitted sender) client-ip=209.85.215.41; Received: by labe2 with SMTP id e2so24604574lab.3 for ; Tue, 31 Mar 2015 16:50:01 -0700 (PDT) X-Received: by 10.152.36.169 with SMTP id r9mr10012270laj.29.1427845801247; Tue, 31 Mar 2015 16:50:01 -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 k9csp305084lbq; Tue, 31 Mar 2015 16:50:00 -0700 (PDT) X-Received: by 10.70.101.65 with SMTP id fe1mr25144719pdb.54.1427845800125; Tue, 31 Mar 2015 16:50:00 -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 kl7si163800pdb.199.2015.03.31.16.49.59 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 31 Mar 2015 16:50:00 -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 padcy3 with SMTP id cy3so34093944pad.3 for ; Tue, 31 Mar 2015 16:49:59 -0700 (PDT) X-Received: by 10.66.147.138 with SMTP id tk10mr36868413pab.119.1427845799050; Tue, 31 Mar 2015 16:49:59 -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 dr5sm86059pdb.48.2015.03.31.16.49.57 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 31 Mar 2015 16:49:58 -0700 (PDT) From: John Stultz To: projectara-software-dev Cc: Mark Greer , Alex Elder , Greg Kroah-Hartman , John Stultz Subject: [PATCH] greybus: Initial I2S definitions Date: Tue, 31 Mar 2015 16:49:56 -0700 Message-Id: <1427845796-19699-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.215.41 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 Signed-off-by: John Stultz --- 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__ */