From patchwork Wed Dec 26 07:03:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cheng-yi Chiang X-Patchwork-Id: 10742851 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7F37C6C5 for ; Wed, 26 Dec 2018 07:04:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B7BC28445 for ; Wed, 26 Dec 2018 07:04:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5F93A28478; Wed, 26 Dec 2018 07:04:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2F0B288F3 for ; Wed, 26 Dec 2018 07:03:58 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id AE575267ABF; Wed, 26 Dec 2018 08:03:56 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 715E3267AC2; Wed, 26 Dec 2018 08:03:54 +0100 (CET) Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) by alsa0.perex.cz (Postfix) with ESMTP id ACD73267A78 for ; Wed, 26 Dec 2018 08:03:48 +0100 (CET) Received: by mail-pf1-f195.google.com with SMTP id c73so7517417pfe.13 for ; Tue, 25 Dec 2018 23:03:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pa2USeBWxO9E+xnUuMkYsZlav0Pofgr2YdMouMcYl5s=; b=YxkR/vGmc5HSCSUvhGuxvs/Zxtj2eyzA90LqmjizrrbL6fjjv5jIWqpntR8nOIyhT8 rUoEofDHafF4krAc0/RNhx2Eay8DOPC1Lvl5qw4mwC+djsCOKnIHtgX3xu8WZa79II7q RhyBqoj/+Uq5ggDDqstL8glC3GyPqyCnWs9mY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=pa2USeBWxO9E+xnUuMkYsZlav0Pofgr2YdMouMcYl5s=; b=ryXvsgCJjCvhOBqy4qPtPXMp26bTTw7fwuoV2LgpvAaU2oTY5v6GtkJXKCllB1Xp/+ /1p4pkPDWasV/LF2YE/TkeDDQzL1TqcXZ8+3Vsx+W99FDVqjnEuch1aB2c1BWo1c/Cu+ 31AWYMEXFx8zYmlxVaLoMdIX1nvh89pNrufSAlUyPuzBgwUTiIxj04sjv2vsuufXH23u zPQ4zzmLZ8nKcTw/zYqimEdY4qhCagzI9RjQAZE5xmVsoob07C/MEohOyf2KmhrAvuxy 0w6IIa01kMyMfSEjKAcUxCuozGPZYnmyNV8vWz2Xl2CK68fu8bEoahjynFRuAaSBay86 iiEA== X-Gm-Message-State: AJcUukdsrJLuy9Hw5tkrn4lnwlgsF8qdk4W1F6oafpiMsPMko8Rcg42+ OERPc7siz9bYAdR0v+ugHulJzA== X-Google-Smtp-Source: ALg8bN4KN4jyMuUGnvrgCt5MHpeTCvYJ6ttdkKbq3AfkTSbsUd+HGCS3lG5boJnRPckCf/hQn0zbxA== X-Received: by 2002:a63:5518:: with SMTP id j24mr17570177pgb.208.1545807826861; Tue, 25 Dec 2018 23:03:46 -0800 (PST) Received: from cychiang-z840.tpe.corp.google.com ([2401:fa00:1:b:e688:dfd2:a1a7:2956]) by smtp.gmail.com with ESMTPSA id n68sm52966030pfb.62.2018.12.25.23.03.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 25 Dec 2018 23:03:45 -0800 (PST) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Date: Wed, 26 Dec 2018 15:03:15 +0800 Message-Id: <20181226070317.72022-1-cychiang@chromium.org> X-Mailer: git-send-email 2.20.1.415.g653613c723-goog MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, tzungbi@chromium.org, Benson Leung , Rob Herring , Mark Brown , Rohit kumar , Guenter Roeck , dgreid@chromium.org, Lee Jones , Cheng-Yi Chiang Subject: [alsa-devel] [PATCH v3 1/3] mfd: cros_ec: Add commands to control codec X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Add EC host commands to control codec on EC. Signed-off-by: Cheng-Yi Chiang Signed-off-by: Lee Jones --- Note: This patch is merged to mfd tree for-mfd-next branch already. But this is still needed on sound tree for-next branch in order to compile cros_ec_codec driver. include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++ 1 file changed, 94 insertions(+) diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h index 9a9631f0559e2..fc91082d4c357 100644 --- a/include/linux/mfd/cros_ec_commands.h +++ b/include/linux/mfd/cros_ec_commands.h @@ -2790,6 +2790,100 @@ struct ec_response_battery_vendor_param { uint32_t value; } __packed; +/*****************************************************************************/ +/* Commands for I2S recording on audio codec. */ + +#define EC_CMD_CODEC_I2S 0x00BC + +enum ec_codec_i2s_subcmd { + EC_CODEC_SET_SAMPLE_DEPTH = 0x0, + EC_CODEC_SET_GAIN = 0x1, + EC_CODEC_GET_GAIN = 0x2, + EC_CODEC_I2S_ENABLE = 0x3, + EC_CODEC_I2S_SET_CONFIG = 0x4, + EC_CODEC_I2S_SET_TDM_CONFIG = 0x5, + EC_CODEC_I2S_SET_BCLK = 0x6, +}; + +enum ec_sample_depth_value { + EC_CODEC_SAMPLE_DEPTH_16 = 0, + EC_CODEC_SAMPLE_DEPTH_24 = 1, +}; + +enum ec_i2s_config { + EC_DAI_FMT_I2S = 0, + EC_DAI_FMT_RIGHT_J = 1, + EC_DAI_FMT_LEFT_J = 2, + EC_DAI_FMT_PCM_A = 3, + EC_DAI_FMT_PCM_B = 4, + EC_DAI_FMT_PCM_TDM = 5, +}; + +struct ec_param_codec_i2s { + /* + * enum ec_codec_i2s_subcmd + */ + uint8_t cmd; + union { + /* + * EC_CODEC_SET_SAMPLE_DEPTH + * Value should be one of ec_sample_depth_value. + */ + uint8_t depth; + + /* + * EC_CODEC_SET_GAIN + * Value should be 0~43 for both channels. + */ + struct ec_param_codec_i2s_set_gain { + uint8_t left; + uint8_t right; + } __packed gain; + + /* + * EC_CODEC_I2S_ENABLE + * 1 to enable, 0 to disable. + */ + uint8_t i2s_enable; + + /* + * EC_CODEC_I2S_SET_COFNIG + * Value should be one of ec_i2s_config. + */ + uint8_t i2s_config; + + /* + * EC_CODEC_I2S_SET_TDM_CONFIG + * Value should be one of ec_i2s_config. + */ + struct ec_param_codec_i2s_tdm { + /* + * 0 to 496 + */ + int16_t ch0_delay; + /* + * -1 to 496 + */ + int16_t ch1_delay; + uint8_t adjacent_to_ch0; + uint8_t adjacent_to_ch1; + } __packed tdm_param; + + /* + * EC_CODEC_I2S_SET_BCLK + */ + uint32_t bclk; + }; +} __packed; + +/* + * For subcommand EC_CODEC_GET_GAIN. + */ +struct ec_response_codec_gain { + uint8_t left; + uint8_t right; +} __packed; + /*****************************************************************************/ /* System commands */