[v3,1/3] mfd: cros_ec: Add commands to control codec
diff mbox series

Message ID 20181226070317.72022-1-cychiang@chromium.org
State New
Headers show
Series
  • [v3,1/3] mfd: cros_ec: Add commands to control codec
Related show

Commit Message

Cheng-yi Chiang Dec. 26, 2018, 7:03 a.m. UTC
Add EC host commands to control codec on EC.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
---
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(+)

Comments

Mark Brown Jan. 7, 2019, 7:24 p.m. UTC | #1
On Wed, Dec 26, 2018 at 03:03:15PM +0800, Cheng-Yi Chiang wrote:

> 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.

Is there a tag I can merge?
Lee Jones Jan. 8, 2019, 9:54 a.m. UTC | #2
On Mon, 07 Jan 2019, Mark Brown wrote:

> On Wed, Dec 26, 2018 at 03:03:15PM +0800, Cheng-Yi Chiang wrote:
> 
> > 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.
> 
> Is there a tag I can merge?

Afraid not, but I reserve the right to rebase my tree, so if you want
one, you can have one.
Mark Brown Jan. 8, 2019, 4:12 p.m. UTC | #3
On Tue, Jan 08, 2019 at 09:54:50AM +0000, Lee Jones wrote:
> On Mon, 07 Jan 2019, Mark Brown wrote:

> > Is there a tag I can merge?

> Afraid not, but I reserve the right to rebase my tree, so if you want
> one, you can have one.

Yes, please - that'd be most helpful!
Cheng-yi Chiang Jan. 28, 2019, 2 a.m. UTC | #4
Hi Lee,
  Could you please give Mark a tag so he can merge ?
The later patch for cros_ec_codec driver is pending on it.

Thanks a lot!

On Wed, Jan 9, 2019 at 12:12 AM Mark Brown <broonie@kernel.org> wrote:

> On Tue, Jan 08, 2019 at 09:54:50AM +0000, Lee Jones wrote:
> > On Mon, 07 Jan 2019, Mark Brown wrote:
>
> > > Is there a tag I can merge?
>
> > Afraid not, but I reserve the right to rebase my tree, so if you want
> > one, you can have one.
>
> Yes, please - that'd be most helpful!
>
Lee Jones Jan. 28, 2019, 6:50 a.m. UTC | #5
On Mon, 28 Jan 2019, Cheng-yi Chiang wrote:

> Hi Lee,
>   Could you please give Mark a tag so he can merge ?
> The later patch for cros_ec_codec driver is pending on it.

Apologies for not getting back to you.

I was waiting to see if my late PR would be merged.

It was, which means the tag you were asking for is actually upstream.

Any issues, let me know.
Cheng-yi Chiang Jan. 29, 2019, 6:54 a.m. UTC | #6
On Mon, Jan 28, 2019 at 2:50 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Mon, 28 Jan 2019, Cheng-yi Chiang wrote:
>
> > Hi Lee,
> >   Could you please give Mark a tag so he can merge ?
> > The later patch for cros_ec_codec driver is pending on it.
>
> Apologies for not getting back to you.
>
> I was waiting to see if my late PR would be merged.
>
> It was, which means the tag you were asking for is actually upstream.
>
> Any issues, let me know.

Hi Lee,
  Thanks for the reply. I see. Yes it was merged in upstream:
c1f3375be60c mfd: cros_ec: Add commands to control codec

Hi Mark,
  I am not sure what would be the best practice for you.
Would it work if you cherrypick this patch from upstream into your branch ?

Thanks!


>
> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog

Patch
diff mbox series

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 */