linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] mfd: cros_ec: Add commands to control codec
@ 2018-12-06  4:05 Cheng-Yi Chiang
  2018-12-14 12:21 ` Lee Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Cheng-Yi Chiang @ 2018-12-06  4:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Lee Jones, Mark Brown, alsa-devel, dgreid, tzungbi, Rohit kumar,
	Cheng-Yi Chiang

Add EC host commands to control codec on EC.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
---
 V2 fixed the wrong ancestor issue so the patch can be applied cleanly on mfd tree.
 Codec driver that uses these commands will be sent separately.
 Thanks!

 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.0.rc1.387.gf8505762e3-goog


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mfd: cros_ec: Add commands to control codec
  2018-12-06  4:05 [PATCH v2] mfd: cros_ec: Add commands to control codec Cheng-Yi Chiang
@ 2018-12-14 12:21 ` Lee Jones
  2018-12-14 12:22   ` Lee Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Jones @ 2018-12-14 12:21 UTC (permalink / raw)
  To: Cheng-Yi Chiang
  Cc: linux-kernel, Mark Brown, alsa-devel, dgreid, tzungbi, Rohit kumar

On Thu, 06 Dec 2018, Cheng-Yi Chiang wrote:

> Add EC host commands to control codec on EC.
> 
> Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> ---
>  V2 fixed the wrong ancestor issue so the patch can be applied cleanly on mfd tree.
>  Codec driver that uses these commands will be sent separately.
>  Thanks!
> 
>  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
>  1 file changed, 94 insertions(+)

Would be good to have this reviewed by some more Chrome people.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mfd: cros_ec: Add commands to control codec
  2018-12-14 12:21 ` Lee Jones
@ 2018-12-14 12:22   ` Lee Jones
  2018-12-18  8:37     ` Cheng-yi Chiang
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Jones @ 2018-12-14 12:22 UTC (permalink / raw)
  To: Cheng-Yi Chiang
  Cc: linux-kernel, Mark Brown, alsa-devel, dgreid, tzungbi, Rohit kumar

On Fri, 14 Dec 2018, Lee Jones wrote:

> On Thu, 06 Dec 2018, Cheng-Yi Chiang wrote:
> 
> > Add EC host commands to control codec on EC.
> > 
> > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > ---
> >  V2 fixed the wrong ancestor issue so the patch can be applied cleanly on mfd tree.
> >  Codec driver that uses these commands will be sent separately.
> >  Thanks!
> > 
> >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> >  1 file changed, 94 insertions(+)
> 
> Would be good to have this reviewed by some more Chrome people.

See this for reference:

  https://lore.kernel.org/patchwork/patch/1024985/

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mfd: cros_ec: Add commands to control codec
  2018-12-14 12:22   ` Lee Jones
@ 2018-12-18  8:37     ` Cheng-yi Chiang
  2018-12-18  8:52       ` Lee Jones
  0 siblings, 1 reply; 6+ messages in thread
From: Cheng-yi Chiang @ 2018-12-18  8:37 UTC (permalink / raw)
  To: Lee Jones, bleung, groeck
  Cc: linux-kernel, Mark Brown, alsa-devel, Dylan Reid, tzungbi,
	Rohit kumar, scollyer

+Benson, Guenter, Scott

On Fri, Dec 14, 2018 at 8:22 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Fri, 14 Dec 2018, Lee Jones wrote:
>
> > On Thu, 06 Dec 2018, Cheng-Yi Chiang wrote:
> >
> > > Add EC host commands to control codec on EC.
> > >
> > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > ---
> > >  V2 fixed the wrong ancestor issue so the patch can be applied cleanly on mfd tree.
> > >  Codec driver that uses these commands will be sent separately.
> > >  Thanks!
> > >
> > >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> > >  1 file changed, 94 insertions(+)
> >
> > Would be good to have this reviewed by some more Chrome people.
>
> See this for reference:
>
>   https://lore.kernel.org/patchwork/patch/1024985/

Hi Benson and Guenter,
Could you please review this patch ?
The corresponding implementation at EC side by Scott is at
https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1356185

Thanks a lot!

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mfd: cros_ec: Add commands to control codec
  2018-12-18  8:37     ` Cheng-yi Chiang
@ 2018-12-18  8:52       ` Lee Jones
  2018-12-22 19:47         ` Guenter Roeck
  0 siblings, 1 reply; 6+ messages in thread
From: Lee Jones @ 2018-12-18  8:52 UTC (permalink / raw)
  To: Cheng-yi Chiang
  Cc: bleung, groeck, linux-kernel, Mark Brown, alsa-devel, Dylan Reid,
	tzungbi, Rohit kumar, scollyer

On Tue, 18 Dec 2018, Cheng-yi Chiang wrote:

> +Benson, Guenter, Scott
> 
> On Fri, Dec 14, 2018 at 8:22 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Fri, 14 Dec 2018, Lee Jones wrote:
> >
> > > On Thu, 06 Dec 2018, Cheng-Yi Chiang wrote:
> > >
> > > > Add EC host commands to control codec on EC.
> > > >
> > > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > > ---
> > > >  V2 fixed the wrong ancestor issue so the patch can be applied cleanly on mfd tree.
> > > >  Codec driver that uses these commands will be sent separately.
> > > >  Thanks!
> > > >
> > > >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> > > >  1 file changed, 94 insertions(+)
> > >
> > > Would be good to have this reviewed by some more Chrome people.
> >
> > See this for reference:
> >
> >   https://lore.kernel.org/patchwork/patch/1024985/
> 
> Hi Benson and Guenter,
> Could you please review this patch ?

You haven't sent them the patch.

Please resubmit as a [RESEND] and add them as recipients.

> The corresponding implementation at EC side by Scott is at
> https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1356185
> 
> Thanks a lot!
> 
> >

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2] mfd: cros_ec: Add commands to control codec
  2018-12-18  8:52       ` Lee Jones
@ 2018-12-22 19:47         ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2018-12-22 19:47 UTC (permalink / raw)
  To: Lee Jones
  Cc: Cheng-yi Chiang, Benson Leung, Guenter Roeck, linux-kernel,
	Mark Brown, alsa-devel, Dylan Reid, tzungbi, Rohit kumar, Scott

On Tue, Dec 18, 2018 at 12:52 AM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Tue, 18 Dec 2018, Cheng-yi Chiang wrote:
>
> > +Benson, Guenter, Scott
> >
> > On Fri, Dec 14, 2018 at 8:22 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Fri, 14 Dec 2018, Lee Jones wrote:
> > >
> > > > On Thu, 06 Dec 2018, Cheng-Yi Chiang wrote:
> > > >
> > > > > Add EC host commands to control codec on EC.
> > > > >
> > > > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > > > ---
> > > > >  V2 fixed the wrong ancestor issue so the patch can be applied cleanly on mfd tree.
> > > > >  Codec driver that uses these commands will be sent separately.
> > > > >  Thanks!
> > > > >
> > > > >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> > > > >  1 file changed, 94 insertions(+)
> > > >
> > > > Would be good to have this reviewed by some more Chrome people.
> > >
> > > See this for reference:
> > >
> > >   https://lore.kernel.org/patchwork/patch/1024985/
> >
> > Hi Benson and Guenter,
> > Could you please review this patch ?
>
> You haven't sent them the patch.
>
> Please resubmit as a [RESEND] and add them as recipients.
>

I was asked separately from one of our engineers if it would be
acceptable to synchronize cros_ec_commands.h with the version from the
EC source. I think that might make more sense than a piece-by-piece
approach.

Thanks,
Guenter

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-12-22 19:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06  4:05 [PATCH v2] mfd: cros_ec: Add commands to control codec Cheng-Yi Chiang
2018-12-14 12:21 ` Lee Jones
2018-12-14 12:22   ` Lee Jones
2018-12-18  8:37     ` Cheng-yi Chiang
2018-12-18  8:52       ` Lee Jones
2018-12-22 19:47         ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).