diff mbox series

[1/3] mfd: cros_ec: Add commands to control codec

Message ID 20181127120041.90759-1-cychiang@chromium.org (mailing list archive)
State New, archived
Headers show
Series [1/3] mfd: cros_ec: Add commands to control codec | expand

Commit Message

Cheng-yi Chiang Nov. 27, 2018, noon UTC
Add EC host commands to control codec on EC.

Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
---
 include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)

Comments

Lee Jones Nov. 28, 2018, 9:34 a.m. UTC | #1
On Tue, 27 Nov 2018, Cheng-Yi Chiang wrote:

> Add EC host commands to control codec on EC.
> 
> Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> ---
>  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
>  1 file changed, 94 insertions(+)

Applied, thanks.
Lee Jones Dec. 3, 2018, 11:19 a.m. UTC | #2
On Wed, 28 Nov 2018, Lee Jones wrote:

> On Tue, 27 Nov 2018, Cheng-Yi Chiang wrote:
> 
> > Add EC host commands to control codec on EC.
> > 
> > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > ---
> >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> >  1 file changed, 94 insertions(+)
> 
> Applied, thanks.

Turns out that this does not actually apply.

What is it based on?
Cheng-yi Chiang Dec. 4, 2018, 1:46 a.m. UTC | #3
On Mon, Dec 3, 2018 at 7:19 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Wed, 28 Nov 2018, Lee Jones wrote:
>
> > On Tue, 27 Nov 2018, Cheng-Yi Chiang wrote:
> >
> > > Add EC host commands to control codec on EC.
> > >
> > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > ---
> > >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> > >  1 file changed, 94 insertions(+)
> >
> > Applied, thanks.
>
> Turns out that this does not actually apply.
>
> What is it based on?

Hi Lee,
I am sorry about that!
The patch series was based on Mark Brown's tree (
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git )
for-next branch.
I will rebase it on upstream master branch in v2 when I address other
comments in codec driver.
Thanks!

>
> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
Cheng-yi Chiang Dec. 5, 2018, 9:01 a.m. UTC | #4
Hi Lee,

I tried to apply this patch based on
for-mfd-next branch of mfd tree (
git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git )
Then, I tried to compile all modules by

 ARCH=x86_64 make allyesconfig
 ARCH=x86_64 make -j64

There was no error.
Could you please let me know what was the error when you failed to
apply this patch ?

Thanks!





On Tue, Dec 4, 2018 at 9:46 AM Cheng-yi Chiang <cychiang@chromium.org> wrote:
>
> On Mon, Dec 3, 2018 at 7:19 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Wed, 28 Nov 2018, Lee Jones wrote:
> >
> > > On Tue, 27 Nov 2018, Cheng-Yi Chiang wrote:
> > >
> > > > Add EC host commands to control codec on EC.
> > > >
> > > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > > ---
> > > >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> > > >  1 file changed, 94 insertions(+)
> > >
> > > Applied, thanks.
> >
> > Turns out that this does not actually apply.
> >
> > What is it based on?
>
> Hi Lee,
> I am sorry about that!
> The patch series was based on Mark Brown's tree (
> https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git )
> for-next branch.
> I will rebase it on upstream master branch in v2 when I address other
> comments in codec driver.
> Thanks!
>
> >
> > --
> > Lee Jones [李琼斯]
> > Linaro Services Technical Lead
> > Linaro.org │ Open source software for ARM SoCs
> > Follow Linaro: Facebook | Twitter | Blog
Lee Jones Dec. 5, 2018, 11:30 a.m. UTC | #5
On Wed, 05 Dec 2018, Cheng-yi Chiang wrote:

> Hi Lee,
> 
> I tried to apply this patch based on
> for-mfd-next branch of mfd tree (
> git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git )
> Then, I tried to compile all modules by
> 
>  ARCH=x86_64 make allyesconfig
>  ARCH=x86_64 make -j64
> 
> There was no error.
> Could you please let me know what was the error when you failed to
> apply this patch ?

Doesn't work for me.

lee@host:~/projects/kernel [for-mfd-next]$ formfdnext
Applying: mfd: cros_ec: Add commands to control codec
error: sha1 information is lacking or useless (include/linux/mfd/cros_ec_commands.h).
error: could not build fake ancestor
Patch failed at 0001 mfd: cros_ec: Add commands to control codec
Use 'git am --show-current-patch' to see the failed patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

> On Tue, Dec 4, 2018 at 9:46 AM Cheng-yi Chiang <cychiang@chromium.org> wrote:
> >
> > On Mon, Dec 3, 2018 at 7:19 PM Lee Jones <lee.jones@linaro.org> wrote:
> > >
> > > On Wed, 28 Nov 2018, Lee Jones wrote:
> > >
> > > > On Tue, 27 Nov 2018, Cheng-Yi Chiang wrote:
> > > >
> > > > > Add EC host commands to control codec on EC.
> > > > >
> > > > > Signed-off-by: Cheng-Yi Chiang <cychiang@chromium.org>
> > > > > ---
> > > > >  include/linux/mfd/cros_ec_commands.h | 94 ++++++++++++++++++++++++++++
> > > > >  1 file changed, 94 insertions(+)
> > > >
> > > > Applied, thanks.
> > >
> > > Turns out that this does not actually apply.
> > >
> > > What is it based on?
> >
> > Hi Lee,
> > I am sorry about that!
> > The patch series was based on Mark Brown's tree (
> > https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git )
> > for-next branch.
> > I will rebase it on upstream master branch in v2 when I address other
> > comments in codec driver.
> > Thanks!
> >
> > >
Lee Jones Dec. 5, 2018, 11:34 a.m. UTC | #6
On Wed, 05 Dec 2018, Lee Jones wrote:

> On Wed, 05 Dec 2018, Cheng-yi Chiang wrote:
> 
> > Hi Lee,
> > 
> > I tried to apply this patch based on
> > for-mfd-next branch of mfd tree (
> > git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git )
> > Then, I tried to compile all modules by
> > 
> >  ARCH=x86_64 make allyesconfig
> >  ARCH=x86_64 make -j64
> > 
> > There was no error.
> > Could you please let me know what was the error when you failed to
> > apply this patch ?
> 
> Doesn't work for me.
> 
> lee@host:~/projects/kernel [for-mfd-next]$ formfdnext
> Applying: mfd: cros_ec: Add commands to control codec
> error: sha1 information is lacking or useless (include/linux/mfd/cros_ec_commands.h).
> error: could not build fake ancestor
> Patch failed at 0001 mfd: cros_ec: Add commands to control codec
> Use 'git am --show-current-patch' to see the failed patch
> When you have resolved this problem, run "git am --continue".
> If you prefer to skip this patch, run "git am --skip" instead.
> To restore the original branch and stop patching, run "git am --abort".

Not that the following lines (as seen in your patch) are not present
in the Mainline kernel.

> @@ -4077,6 +4077,100 @@ struct __ec_align1 ec_response_i2c_passthru_protect {
>  	uint8_t status;		/* Status flags (0: unlocked, 1: locked) */
>  };

Do you have other patches applied to your tree?
Cheng-yi Chiang Dec. 6, 2018, 2:36 a.m. UTC | #7
On Wed, Dec 5, 2018 at 7:34 PM Lee Jones <lee.jones@linaro.org> wrote:
>
> On Wed, 05 Dec 2018, Lee Jones wrote:
>
> > On Wed, 05 Dec 2018, Cheng-yi Chiang wrote:
> >
> > > Hi Lee,
> > >
> > > I tried to apply this patch based on
> > > for-mfd-next branch of mfd tree (
> > > git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git )
> > > Then, I tried to compile all modules by
> > >
> > >  ARCH=x86_64 make allyesconfig
> > >  ARCH=x86_64 make -j64
> > >
> > > There was no error.
> > > Could you please let me know what was the error when you failed to
> > > apply this patch ?
> >
> > Doesn't work for me.
> >
> > lee@host:~/projects/kernel [for-mfd-next]$ formfdnext
> > Applying: mfd: cros_ec: Add commands to control codec
> > error: sha1 information is lacking or useless (include/linux/mfd/cros_ec_commands.h).
> > error: could not build fake ancestor
> > Patch failed at 0001 mfd: cros_ec: Add commands to control codec
> > Use 'git am --show-current-patch' to see the failed patch
> > When you have resolved this problem, run "git am --continue".
> > If you prefer to skip this patch, run "git am --skip" instead.
> > To restore the original branch and stop patching, run "git am --abort".
>
> Not that the following lines (as seen in your patch) are not present
> in the Mainline kernel.
>
> > @@ -4077,6 +4077,100 @@ struct __ec_align1 ec_response_i2c_passthru_protect {
> >       uint8_t status;         /* Status flags (0: unlocked, 1: locked) */
> >  };
>
> Do you have other patches applied to your tree?

Hi Lee,
Sorry, I see the problem.
I was using git am -3 which solves the conflict by itself.
I will resend a patch based on your for-mfd-next branch so we can keep
the patch clean.
Thanks for your time.

>
> --
> Lee Jones [李琼斯]
> Linaro Services Technical Lead
> Linaro.org │ Open source software for ARM SoCs
> Follow Linaro: Facebook | Twitter | Blog
Lee Jones Dec. 7, 2018, 7:23 a.m. UTC | #8
On Thu, 06 Dec 2018, Cheng-yi Chiang wrote:

> On Wed, Dec 5, 2018 at 7:34 PM Lee Jones <lee.jones@linaro.org> wrote:
> >
> > On Wed, 05 Dec 2018, Lee Jones wrote:
> >
> > > On Wed, 05 Dec 2018, Cheng-yi Chiang wrote:
> > >
> > > > Hi Lee,
> > > >
> > > > I tried to apply this patch based on
> > > > for-mfd-next branch of mfd tree (
> > > > git://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git )
> > > > Then, I tried to compile all modules by
> > > >
> > > >  ARCH=x86_64 make allyesconfig
> > > >  ARCH=x86_64 make -j64
> > > >
> > > > There was no error.
> > > > Could you please let me know what was the error when you failed to
> > > > apply this patch ?
> > >
> > > Doesn't work for me.
> > >
> > > lee@host:~/projects/kernel [for-mfd-next]$ formfdnext
> > > Applying: mfd: cros_ec: Add commands to control codec
> > > error: sha1 information is lacking or useless (include/linux/mfd/cros_ec_commands.h).
> > > error: could not build fake ancestor
> > > Patch failed at 0001 mfd: cros_ec: Add commands to control codec
> > > Use 'git am --show-current-patch' to see the failed patch
> > > When you have resolved this problem, run "git am --continue".
> > > If you prefer to skip this patch, run "git am --skip" instead.
> > > To restore the original branch and stop patching, run "git am --abort".
> >
> > Not that the following lines (as seen in your patch) are not present
> > in the Mainline kernel.
> >
> > > @@ -4077,6 +4077,100 @@ struct __ec_align1 ec_response_i2c_passthru_protect {
> > >       uint8_t status;         /* Status flags (0: unlocked, 1: locked) */
> > >  };
> >
> > Do you have other patches applied to your tree?
> 
> Hi Lee,
> Sorry, I see the problem.
> I was using git am -3 which solves the conflict by itself.

That's what I use, but it still had issues.

Git is probably using a previous resolution in your case.

> I will resend a patch based on your for-mfd-next branch so we can keep
> the patch clean.
> Thanks for your time.
diff mbox series

Patch

diff --git a/include/linux/mfd/cros_ec_commands.h b/include/linux/mfd/cros_ec_commands.h
index 07fe4ea0361d3..a3ac792f4915b 100644
--- a/include/linux/mfd/cros_ec_commands.h
+++ b/include/linux/mfd/cros_ec_commands.h
@@ -4077,6 +4077,100 @@  struct __ec_align1 ec_response_i2c_passthru_protect {
 	uint8_t status;		/* Status flags (0: unlocked, 1: locked) */
 };
 
+/*****************************************************************************/
+/* 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 */