From patchwork Sat Oct 5 08:55:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tzung-Bi Shih X-Patchwork-Id: 11175541 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 40DDA1747 for ; Sat, 5 Oct 2019 08:59:25 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id B1675222C0 for ; Sat, 5 Oct 2019 08:59:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="jlkZOIXu"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="HA63YnvT" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B1675222C0 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E5E1D1684; Sat, 5 Oct 2019 10:58:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E5E1D1684 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570265963; bh=fqTy5MERAc/zubfe/oe51WGUO8MQb6O8zYfyfwZMrY0=; h=Date:In-Reply-To:References:From:To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=jlkZOIXuDqzU0TvwgpCbwgx6ittpL/J+dg46vMK9BpRSQxoFvk0lM1B4X3SjAa9Rh XnQ2Vy5yVKiiRdhVo1EAyzcBhd7sVMQ3wRQoR4QihfpH+2JD2Fpte0jJtZXBv0/2Or 4vqHsp1vlA7UINZBXyOOi5K3qmYVktE/2Vb/daYQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id CABBDF80637; Sat, 5 Oct 2019 10:55:49 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 526FFF80634; Sat, 5 Oct 2019 10:55:48 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-7.6 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=disabled version=3.4.0 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8206DF8060E for ; Sat, 5 Oct 2019 10:55:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8206DF8060E Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="HA63YnvT" Received: by mail-qt1-x84a.google.com with SMTP id e13so9257729qto.18 for ; Sat, 05 Oct 2019 01:55:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=NeC00R2HDPjugyY089WdATWGGggY9LDPrJpjGM7g9N0=; b=HA63YnvTlCHwLR7RikE43au83U2kH0GFPU4sNivHnLgJxQnb2MWeb8nQH/z8XKV2x1 pE6ee9AJOeyngJL+haLKq6I/pEGCFuZfkQ1cN+9IpzvGyrtZPVEmN4NASKq/WXalx2rk UBjXWrbKCiTu0KQbGCWKP125wZMe+4ubitSrAaLPOd21HriUZchbIB6blzmfpE7GTcKu yxVZRHdsj/07u9S5So4z15n4L3miJgt8tbfALGimEvVB8OYwzomQCtgLwYqGR8lA3y54 g9fmKNSqrQXULvxcyDkyKXEwjVEWKpvYixiBgnNaz+/BJU4pY3l0LInVbWc7SiGBPTHr qYcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=NeC00R2HDPjugyY089WdATWGGggY9LDPrJpjGM7g9N0=; b=ltsmztjfnPjMfFbq0DvNMFqjpLSyvqwDrmleENU4DdLIs7eIHHt8iNyJ59gtsvbHnh ny4UpAGmJPOv+Gc2K40iKDkUtI6MvBiQrwKgKC5K+FLjd75zsJxHWUBP1HDw7T9PUnJ4 PjvhTWVD4kIxObtUszRy6wdWr/cA+ItrPwVbETq7q0F9czNYCMOJg6d9smwEAD/gg5b2 bNrkUUl964K4J8PD9+0ElxvJhWwxeLOlQycmM4pPbovj5nhslsBu6nHQmhCFvNvdXzsm JFaivsdXjcHVQ+2IWG2veq+uzGh0nQ1I01Ime7Gz9jclaZgUVmv8TDb0zqEnvRbv/7/W Wapg== X-Gm-Message-State: APjAAAUFUYAdyAWMmoSnuLQ/C1H7VG+UqIQqpQ9T+uLWvbK5ofAHqRsh fLsVVy9Oc477JRiTjKUL2/WDAPGyRHDZ X-Google-Smtp-Source: APXvYqxK5HKboiDDViqVqXfWdAQ059eKlyh5b/7riTV8ad0+Uw1jm7/PXCVkjf0fhmm1z3ev3SakuBcq9EHG X-Received: by 2002:a05:6214:1226:: with SMTP id p6mr18236893qvv.167.1570265743620; Sat, 05 Oct 2019 01:55:43 -0700 (PDT) Date: Sat, 5 Oct 2019 16:55:03 +0800 In-Reply-To: <20191005085509.187179-1-tzungbi@google.com> Message-Id: <20191005164320.04.Idc3c6e1cd94b70bf010249928d4a93c6c90495b7@changeid> Mime-Version: 1.0 References: <20191005085509.187179-1-tzungbi@google.com> X-Mailer: git-send-email 2.23.0.581.g78d2f28ef7-goog From: Tzung-Bi Shih To: broonie@kernel.org Cc: gwendal@google.com, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, drinkcat@google.com, tzungbi@google.com, robh+dt@kernel.org, enric.balletbo@collabora.com, bleung@google.com, dgreid@google.com Subject: [alsa-devel] [PATCH v2 04/10] platform/chrome: cros_ec: add common commands for EC codec X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" Add the following common commands: - GET_CAPABILITIES - GET_SHM_ADDR - SET_SHM_ADDR Signed-off-by: Tzung-Bi Shih --- drivers/platform/chrome/cros_ec_trace.c | 1 + .../linux/platform_data/cros_ec_commands.h | 64 ++++++++++++++++++- 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/drivers/platform/chrome/cros_ec_trace.c b/drivers/platform/chrome/cros_ec_trace.c index e73bb6a8b00e..2ea0d4e0d54d 100644 --- a/drivers/platform/chrome/cros_ec_trace.c +++ b/drivers/platform/chrome/cros_ec_trace.c @@ -98,6 +98,7 @@ TRACE_SYMBOL(EC_CMD_SB_READ_BLOCK), \ TRACE_SYMBOL(EC_CMD_SB_WRITE_BLOCK), \ TRACE_SYMBOL(EC_CMD_BATTERY_VENDOR_PARAM), \ + TRACE_SYMBOL(EC_CMD_EC_CODEC), \ TRACE_SYMBOL(EC_CMD_EC_CODEC_DMIC), \ TRACE_SYMBOL(EC_CMD_EC_CODEC_I2S_RX), \ TRACE_SYMBOL(EC_CMD_REBOOT_EC), \ diff --git a/include/linux/platform_data/cros_ec_commands.h b/include/linux/platform_data/cros_ec_commands.h index 58e460c015ef..3ca0fa9e92a7 100644 --- a/include/linux/platform_data/cros_ec_commands.h +++ b/include/linux/platform_data/cros_ec_commands.h @@ -4466,8 +4466,68 @@ enum mkbp_cec_event { /*****************************************************************************/ +/* Commands for audio codec. */ +#define EC_CMD_EC_CODEC 0x00BC + +enum ec_codec_subcmd { + EC_CODEC_GET_CAPABILITIES = 0x0, + EC_CODEC_GET_SHM_ADDR = 0x1, + EC_CODEC_SET_SHM_ADDR = 0x2, + EC_CODEC_SUBCMD_COUNT, +}; + +enum ec_codec_cap { + EC_CODEC_CAP_LAST = 32, +}; + +enum ec_codec_shm_id { + EC_CODEC_SHM_ID_LAST, +}; + +enum ec_codec_shm_type { + EC_CODEC_SHM_TYPE_EC_RAM = 0x0, + EC_CODEC_SHM_TYPE_SYSTEM_RAM = 0x1, +}; + +struct __ec_align1 ec_param_ec_codec_get_shm_addr { + uint8_t shm_id; + uint8_t reserved[3]; +}; + +struct __ec_align4 ec_param_ec_codec_set_shm_addr { + uint64_t phys_addr; + uint32_t len; + uint8_t shm_id; + uint8_t reserved[3]; +}; + +struct __ec_align4 ec_param_ec_codec { + uint8_t cmd; /* enum ec_codec_subcmd */ + uint8_t reserved[3]; + + union { + struct ec_param_ec_codec_get_shm_addr + get_shm_addr_param; + struct ec_param_ec_codec_set_shm_addr + set_shm_addr_param; + }; +}; + +struct __ec_align4 ec_response_ec_codec_get_capabilities { + uint32_t capabilities; +}; + +struct __ec_align4 ec_response_ec_codec_get_shm_addr { + uint64_t phys_addr; + uint32_t len; + uint8_t type; + uint8_t reserved[3]; +}; + +/*****************************************************************************/ + /* Commands for DMIC on audio codec. */ -#define EC_CMD_EC_CODEC_DMIC 0x00BC +#define EC_CMD_EC_CODEC_DMIC 0x00BD enum ec_codec_dmic_subcmd { EC_CODEC_DMIC_SET_GAIN = 0x0, @@ -4500,7 +4560,7 @@ struct __ec_align1 ec_response_ec_codec_dmic_get_gain { /* Commands for I2S RX on audio codec. */ -#define EC_CMD_EC_CODEC_I2S_RX 0x00BD +#define EC_CMD_EC_CODEC_I2S_RX 0x00BE enum ec_codec_i2s_rx_subcmd { EC_CODEC_I2S_RX_ENABLE = 0x0,