Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3390671imu; Mon, 24 Dec 2018 00:39:02 -0800 (PST) X-Google-Smtp-Source: AFSGD/V3VnQfHLfRlTJOes6WB7bkyjv9Sn7JsOd+bTfKzFYw9ZAvKchO7POefFrwDXvytlr4gSqt X-Received: by 2002:a62:2f06:: with SMTP id v6mr12540535pfv.216.1545640742403; Mon, 24 Dec 2018 00:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545640742; cv=none; d=google.com; s=arc-20160816; b=EJHtwWN8iUxs9hFq5CLY/Oc7YiuXOD2ZHTx1FkHet6kBjhYL7RvjvB5y1h0kUxRbGo xOoEafhihHWF80afN7e0bQEHERrQIJeSBKPN0zGC/IirpIywVzJXXdQ1PDV+m5ZTfQcw CkbhYIKFsnBoGLV7X8CwlzMpQOULnpiyInWclYv0ZPhutMFgd6eIV493gALBkYSbP6Tx jAEwEaXv0j5gzBIib+PBuagBE2gCJohKfSuQr91UxORja0b/tjFKlAR6r4ZXwITUtigh skzj4NEr4XS6ZRNWwrhtlz8PNrc+L9SqQHDlcHP1v3rDV3GdB4Lq/4eRYxqyZZnAcXU/ g5Nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=jCd+hczgR1aJ/LYMR/UN9ryjdYIcfPKLHku5JEL6k74=; b=Bv4gb/g1ubV/8shtXsW8elIBObnZ5oxkPsK/MpZoCdLBs3lmFa0TyFdkWQpgng2x6I B6sJBhHP61IYmqmCkNU4oZ4E/P0KAjAf8xOYkyBPzzo7LrvHSqYI5Q9HKPC5ZzdEXTm9 92uFedfkT1hR1Ihb9BaGxGYYBy4UUfCs47kgcCONFvoBLMJbzXe4BplwYedVv9l1yGJe QbgdXMK9Eaq12A2xi+2mw8wE52+S1mYLUBadGWO7CZnUhVr3F8K191R1201RweWHBr33 NspPKnD2qGyyemoWqM7eNi6+gIHErGJ0o1MVj5gqGGO89ANZvXbczKI4PRA20ckr6Wrl CzIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PUuSTXPN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id bf4si11627137plb.163.2018.12.24.00.38.46; Mon, 24 Dec 2018 00:39:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=PUuSTXPN; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726843AbeLXIh4 (ORCPT + 99 others); Mon, 24 Dec 2018 03:37:56 -0500 Received: from mail-pg1-f195.google.com ([209.85.215.195]:47015 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726788AbeLXIh4 (ORCPT ); Mon, 24 Dec 2018 03:37:56 -0500 Received: by mail-pg1-f195.google.com with SMTP id w7so5341378pgp.13 for ; Mon, 24 Dec 2018 00:37:55 -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=jCd+hczgR1aJ/LYMR/UN9ryjdYIcfPKLHku5JEL6k74=; b=PUuSTXPNEZ9RsiE0UUGp+8e7LJc3txPFJyg8m4bVvQNkBkju7Kmp52W95AY2dIc765 7kcQ2W86JkHa3lpk2SnfGnFTnnKRvvjMAZPqN5yC+asgL+WTMyaYRYd78zzHcPislej1 VkyZF+I9sR9GQQx+qAZPekyHjl03yXv4tYyrM= 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=jCd+hczgR1aJ/LYMR/UN9ryjdYIcfPKLHku5JEL6k74=; b=eTVyxw/b+/zCaZTsXiqBx+ya8O0v4Lwr3G4JHriRuIBFxxX00wWJBulItOwRF/AF0B CYjJky55xO1lJyRNbS7zhE1Iok7hZhLYqEJyep4PKKbEoT9w1SSgqZCdgltgu7W1hn+L cy9carrJOsZJa8vHC7zrWyT0pcYPBN9PHimqM5XEgjGEGsrY3N4eG43pVTVSKPTttQ5C 6Vk8LEQ8E2NpUHrqRFIuhgofzxZVtyH+MpOoIfMAh3YeiqFj758DZCqtE6YODOIRO3s+ /ZFqgEQVr4Za3sGoXhy52RyfpCK5WHW6NIdkO1YHZsM5VaUfJS0WV2AoKd7tvatfeMSM JAug== X-Gm-Message-State: AA+aEWYLFOIXqiyfW2uB+TJ2SAMqLGdRqTSceJLkkJ8nJJ3+gGQ3UmUC 6TkyG47RXkblIXdJZmfD55jOMbebx9s= X-Received: by 2002:a62:130c:: with SMTP id b12mr12446240pfj.247.1545640674599; Mon, 24 Dec 2018 00:37:54 -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 r130sm59078720pfr.48.2018.12.24.00.37.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 24 Dec 2018 00:37:53 -0800 (PST) From: Cheng-Yi Chiang To: linux-kernel@vger.kernel.org Cc: Benson Leung , Guenter Roeck , Lee Jones , Mark Brown , alsa-devel@alsa-project.org, dgreid@chromium.org, tzungbi@chromium.org, Rohit kumar , Cheng-Yi Chiang Subject: [PATCH v2 1/3] mfd: cros_ec: Add commands to control codec Date: Mon, 24 Dec 2018 16:37:22 +0800 Message-Id: <20181224083724.75618-1-cychiang@chromium.org> X-Mailer: git-send-email 2.20.1.415.g653613c723-goog MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 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 */ -- 2.20.1.415.g653613c723-goog