From: Andrew Jackson <Andrew.Jackson@arm.com> To: Jean-Francois Moine <moinejf@free.fr>, Mark Brown <broonie@kernel.org>, Russell King - ARM Linux <linux@arm.linux.org.uk> Cc: Dave Airlie <airlied@gmail.com>, Jyri Sarha <jsarha@ti.com>, "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>, "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org> Subject: Re: [PATCH v9 1/4] drm/i2c: tda998x: Add DT support for audio Date: Wed, 07 Jan 2015 14:39:13 +0000 [thread overview] Message-ID: <54AD4511.30702@arm.com> (raw) In-Reply-To: <0084acea5a3475a77531d6a77483f36d3469111a.1420628786.git.moinejf@free.fr> On 01/07/15 09:10, Jean-Francois Moine wrote: > This patch permits the definition of the audio ports from the device tree. > > Signed-off-by: Jean-Francois Moine <moinejf@free.fr> > --- > .../devicetree/bindings/drm/i2c/tda998x.txt | 18 +++++++ > drivers/gpu/drm/i2c/tda998x_drv.c | 60 ++++++++++++++++++---- > 2 files changed, 69 insertions(+), 9 deletions(-) > > diff --git a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt > index e9e4bce..e50e7cd 100644 > --- a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt > +++ b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt > @@ -17,6 +17,20 @@ Optional properties: > - video-ports: 24 bits value which defines how the video controller > output is wired to the TDA998x input - default: <0x230145> > > + - audio-ports: must contain one or two values selecting the source > + in the audio port. > + The source type is given by the corresponding entry in > + the audio-port-names property. I think that this entry might benefit from a little more explanation. The value specified here selects which pins on the chip provide the audio input doesn't it? In the outline datasheet that I have these are listed in table 17: Audio port Input configuration S/PDIF I2S-bus AP0 - WS (word select) AP1 S/PDIF input I2S-bus channel 0 AP2 S/PDIF input I2S-bus channel 1 AP3[1] I2S-bus channel 2 AP4[1] I2S-bus channel 3 ACLK - SCK (I2S-bus clock) [1] Depending on package. Andrew > + > + - audio-port-names: must contain entries matching the entries in > + the audio-ports property. > + Each value may be "i2s" or "spdif", giving the type of > + the audio source. > + > + - #sound-dai-cells: must be set to <1> for use with the simple-card. > + The TDA998x audio CODEC always defines two DAIs. > + The DAI 0 is the S/PDIF input and the DAI 1 is the I2S input. > + > Example: > > tda998x: hdmi-encoder { > @@ -26,4 +40,8 @@ Example: > interrupts = <27 2>; /* falling edge */ > pinctrl-0 = <&pmx_camera>; > pinctrl-names = "default"; > + > + audio-ports = <0x04>, <0x03>; > + audio-port-names = "spdif", "i2s"; > + #sound-dai-cells = <1>; > }; > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c > index 70658af..9d9b072 100644 > --- a/drivers/gpu/drm/i2c/tda998x_drv.c > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c > @@ -20,6 +20,7 @@ > #include <linux/module.h> > #include <linux/irq.h> > #include <sound/asoundef.h> > +#include <linux/platform_device.h> > > #include <drm/drmP.h> > #include <drm/drm_crtc_helper.h> > @@ -44,6 +45,8 @@ struct tda998x_priv { > wait_queue_head_t wq_edid; > volatile int wq_edid_wait; > struct drm_encoder *encoder; > + > + u8 audio_ports[2]; > }; > > #define to_tda998x_priv(x) ((struct tda998x_priv *)to_encoder_slave(x)->slave_priv) > @@ -1254,12 +1257,16 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) > { > struct device_node *np = client->dev.of_node; > u32 video; > - int rev_lo, rev_hi, ret; > + int i, rev_lo, rev_hi, ret; > + const char *p; > > priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3); > priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1); > priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5); > > + priv->params.audio_frame[1] = 1; /* channels - 1 */ > + priv->params.audio_sample_rate = 48000; /* 48kHz */ > + > priv->current_page = 0xff; > priv->hdmi = client; > priv->cec = i2c_new_dummy(client->adapter, 0x34); > @@ -1351,15 +1358,50 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) > /* enable EDID read irq: */ > reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD); > > - if (!np) > - return 0; /* non-DT */ > + /* get the device tree parameters */ > + if (np) { > + > + /* optional video properties */ > + ret = of_property_read_u32(np, "video-ports", &video); > + if (ret == 0) { > + priv->vip_cntrl_0 = video >> 16; > + priv->vip_cntrl_1 = video >> 8; > + priv->vip_cntrl_2 = video; > + } > + > + /* optional audio properties */ > + for (i = 0; i < 2; i++) { > + u32 port; > > - /* get the optional video properties */ > - ret = of_property_read_u32(np, "video-ports", &video); > - if (ret == 0) { > - priv->vip_cntrl_0 = video >> 16; > - priv->vip_cntrl_1 = video >> 8; > - priv->vip_cntrl_2 = video; > + ret = of_property_read_u32_index(np, "audio-ports", i, &port); > + if (ret) > + break; > + ret = of_property_read_string_index(np, "audio-port-names", > + i, &p); > + if (ret) { > + dev_err(&client->dev, > + "missing audio-port-names[%d]\n", i); > + break; > + } > + if (strcmp(p, "spdif") == 0) { > + priv->audio_ports[0] = port; > + } else if (strcmp(p, "i2s") == 0) { > + priv->audio_ports[1] = port; > + } else { > + dev_err(&client->dev, > + "bad audio-port-names '%s'\n", p); > + break; > + } > + } > + if (priv->audio_ports[0]) { > + priv->params.audio_cfg = priv->audio_ports[0]; > + priv->params.audio_format = AFMT_SPDIF; > + priv->params.audio_clk_cfg = 0; > + } else { > + priv->params.audio_cfg = priv->audio_ports[1]; > + priv->params.audio_format = AFMT_I2S; > + priv->params.audio_clk_cfg = 1; > + } > } > > return 0; >
WARNING: multiple messages have this Message-ID (diff)
From: Andrew Jackson <Andrew.Jackson@arm.com> To: Jean-Francois Moine <moinejf@free.fr>, Mark Brown <broonie@kernel.org>, Russell King - ARM Linux <linux@arm.linux.org.uk> Cc: "devicetree@vger.kernel.org" <devicetree@vger.kernel.org>, "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>, Jyri Sarha <jsarha@ti.com>, Dave Airlie <airlied@gmail.com> Subject: Re: [PATCH v9 1/4] drm/i2c: tda998x: Add DT support for audio Date: Wed, 07 Jan 2015 14:39:13 +0000 [thread overview] Message-ID: <54AD4511.30702@arm.com> (raw) In-Reply-To: <0084acea5a3475a77531d6a77483f36d3469111a.1420628786.git.moinejf@free.fr> On 01/07/15 09:10, Jean-Francois Moine wrote: > This patch permits the definition of the audio ports from the device tree. > > Signed-off-by: Jean-Francois Moine <moinejf@free.fr> > --- > .../devicetree/bindings/drm/i2c/tda998x.txt | 18 +++++++ > drivers/gpu/drm/i2c/tda998x_drv.c | 60 ++++++++++++++++++---- > 2 files changed, 69 insertions(+), 9 deletions(-) > > diff --git a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt > index e9e4bce..e50e7cd 100644 > --- a/Documentation/devicetree/bindings/drm/i2c/tda998x.txt > +++ b/Documentation/devicetree/bindings/drm/i2c/tda998x.txt > @@ -17,6 +17,20 @@ Optional properties: > - video-ports: 24 bits value which defines how the video controller > output is wired to the TDA998x input - default: <0x230145> > > + - audio-ports: must contain one or two values selecting the source > + in the audio port. > + The source type is given by the corresponding entry in > + the audio-port-names property. I think that this entry might benefit from a little more explanation. The value specified here selects which pins on the chip provide the audio input doesn't it? In the outline datasheet that I have these are listed in table 17: Audio port Input configuration S/PDIF I2S-bus AP0 - WS (word select) AP1 S/PDIF input I2S-bus channel 0 AP2 S/PDIF input I2S-bus channel 1 AP3[1] I2S-bus channel 2 AP4[1] I2S-bus channel 3 ACLK - SCK (I2S-bus clock) [1] Depending on package. Andrew > + > + - audio-port-names: must contain entries matching the entries in > + the audio-ports property. > + Each value may be "i2s" or "spdif", giving the type of > + the audio source. > + > + - #sound-dai-cells: must be set to <1> for use with the simple-card. > + The TDA998x audio CODEC always defines two DAIs. > + The DAI 0 is the S/PDIF input and the DAI 1 is the I2S input. > + > Example: > > tda998x: hdmi-encoder { > @@ -26,4 +40,8 @@ Example: > interrupts = <27 2>; /* falling edge */ > pinctrl-0 = <&pmx_camera>; > pinctrl-names = "default"; > + > + audio-ports = <0x04>, <0x03>; > + audio-port-names = "spdif", "i2s"; > + #sound-dai-cells = <1>; > }; > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c > index 70658af..9d9b072 100644 > --- a/drivers/gpu/drm/i2c/tda998x_drv.c > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c > @@ -20,6 +20,7 @@ > #include <linux/module.h> > #include <linux/irq.h> > #include <sound/asoundef.h> > +#include <linux/platform_device.h> > > #include <drm/drmP.h> > #include <drm/drm_crtc_helper.h> > @@ -44,6 +45,8 @@ struct tda998x_priv { > wait_queue_head_t wq_edid; > volatile int wq_edid_wait; > struct drm_encoder *encoder; > + > + u8 audio_ports[2]; > }; > > #define to_tda998x_priv(x) ((struct tda998x_priv *)to_encoder_slave(x)->slave_priv) > @@ -1254,12 +1257,16 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) > { > struct device_node *np = client->dev.of_node; > u32 video; > - int rev_lo, rev_hi, ret; > + int i, rev_lo, rev_hi, ret; > + const char *p; > > priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(2) | VIP_CNTRL_0_SWAP_B(3); > priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(0) | VIP_CNTRL_1_SWAP_D(1); > priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(4) | VIP_CNTRL_2_SWAP_F(5); > > + priv->params.audio_frame[1] = 1; /* channels - 1 */ > + priv->params.audio_sample_rate = 48000; /* 48kHz */ > + > priv->current_page = 0xff; > priv->hdmi = client; > priv->cec = i2c_new_dummy(client->adapter, 0x34); > @@ -1351,15 +1358,50 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) > /* enable EDID read irq: */ > reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD); > > - if (!np) > - return 0; /* non-DT */ > + /* get the device tree parameters */ > + if (np) { > + > + /* optional video properties */ > + ret = of_property_read_u32(np, "video-ports", &video); > + if (ret == 0) { > + priv->vip_cntrl_0 = video >> 16; > + priv->vip_cntrl_1 = video >> 8; > + priv->vip_cntrl_2 = video; > + } > + > + /* optional audio properties */ > + for (i = 0; i < 2; i++) { > + u32 port; > > - /* get the optional video properties */ > - ret = of_property_read_u32(np, "video-ports", &video); > - if (ret == 0) { > - priv->vip_cntrl_0 = video >> 16; > - priv->vip_cntrl_1 = video >> 8; > - priv->vip_cntrl_2 = video; > + ret = of_property_read_u32_index(np, "audio-ports", i, &port); > + if (ret) > + break; > + ret = of_property_read_string_index(np, "audio-port-names", > + i, &p); > + if (ret) { > + dev_err(&client->dev, > + "missing audio-port-names[%d]\n", i); > + break; > + } > + if (strcmp(p, "spdif") == 0) { > + priv->audio_ports[0] = port; > + } else if (strcmp(p, "i2s") == 0) { > + priv->audio_ports[1] = port; > + } else { > + dev_err(&client->dev, > + "bad audio-port-names '%s'\n", p); > + break; > + } > + } > + if (priv->audio_ports[0]) { > + priv->params.audio_cfg = priv->audio_ports[0]; > + priv->params.audio_format = AFMT_SPDIF; > + priv->params.audio_clk_cfg = 0; > + } else { > + priv->params.audio_cfg = priv->audio_ports[1]; > + priv->params.audio_format = AFMT_I2S; > + priv->params.audio_clk_cfg = 1; > + } > } > > return 0; >
next prev parent reply other threads:[~2015-01-07 14:39 UTC|newest] Thread overview: 115+ messages / expand[flat|nested] mbox.gz Atom feed top 2015-01-07 11:06 [PATCH v9 0/4] ASoC: tda998x: add a codec to the HDMI transmitter Jean-Francois Moine 2015-01-07 11:06 ` Jean-Francois Moine 2015-01-07 9:10 ` [PATCH v9 1/4] drm/i2c: tda998x: Add DT support for audio Jean-Francois Moine 2015-01-07 9:10 ` Jean-Francois Moine 2015-01-07 14:39 ` Andrew Jackson [this message] 2015-01-07 14:39 ` Andrew Jackson 2015-01-07 17:08 ` Jean-Francois Moine 2015-01-07 17:08 ` Jean-Francois Moine 2015-01-07 17:18 ` Andrew Jackson 2015-01-07 17:18 ` Andrew Jackson 2015-01-07 17:33 ` Mark Brown 2015-01-08 14:53 ` Jyri Sarha 2015-01-08 14:53 ` Jyri Sarha 2015-01-08 16:42 ` Jean-Francois Moine 2015-01-08 16:42 ` Jean-Francois Moine 2015-01-08 20:04 ` Mark Brown 2015-01-08 20:04 ` Mark Brown 2015-01-09 9:25 ` Andrew Jackson 2015-01-09 9:25 ` Andrew Jackson 2015-01-09 10:13 ` Jyri Sarha 2015-01-09 10:13 ` Jyri Sarha 2015-01-09 11:30 ` Jean-Francois Moine 2015-01-09 11:30 ` Jean-Francois Moine 2015-01-09 11:45 ` Russell King - ARM Linux 2015-01-09 11:45 ` Russell King - ARM Linux 2015-01-09 12:54 ` Jean-Francois Moine 2015-01-09 12:54 ` Jean-Francois Moine 2015-01-09 13:07 ` Russell King - ARM Linux 2015-01-09 13:07 ` Russell King - ARM Linux 2015-01-09 13:58 ` Andrew Jackson 2015-01-09 13:58 ` Andrew Jackson 2015-01-09 14:57 ` Russell King - ARM Linux 2015-01-09 17:38 ` Jean-Francois Moine 2015-01-09 17:38 ` Jean-Francois Moine 2015-01-09 20:01 ` Russell King - ARM Linux 2015-01-09 20:01 ` Russell King - ARM Linux 2015-01-10 15:47 ` [alsa-devel] " Jean-Francois Moine 2015-01-10 15:47 ` Jean-Francois Moine 2015-01-12 9:25 ` Philipp Zabel 2015-01-12 9:25 ` Philipp Zabel 2015-01-12 12:25 ` Russell King - ARM Linux 2015-01-12 13:59 ` Philipp Zabel 2015-01-12 13:59 ` Philipp Zabel 2015-01-12 14:04 ` Russell King - ARM Linux 2015-01-12 14:04 ` Russell King - ARM Linux 2015-01-12 17:13 ` Jean-Francois Moine 2015-01-12 17:13 ` Jean-Francois Moine 2015-01-12 17:57 ` Russell King - ARM Linux 2015-01-12 17:57 ` Russell King - ARM Linux 2015-01-12 19:14 ` Jean-Francois Moine 2015-01-12 19:14 ` Jean-Francois Moine 2015-01-13 12:21 ` Philipp Zabel 2015-01-13 12:21 ` Philipp Zabel 2015-01-13 12:27 ` Russell King - ARM Linux 2015-01-13 12:27 ` Russell King - ARM Linux 2015-01-13 15:54 ` Jean-Francois Moine 2015-01-13 15:54 ` Jean-Francois Moine 2015-01-13 16:03 ` Russell King - ARM Linux 2015-01-13 16:03 ` Russell King - ARM Linux 2015-01-13 19:02 ` Jean-Francois Moine 2015-01-13 19:02 ` Jean-Francois Moine 2015-01-13 19:26 ` Russell King - ARM Linux 2015-01-13 19:26 ` Russell King - ARM Linux 2015-01-13 19:41 ` Jyri Sarha 2015-01-13 19:41 ` Jyri Sarha 2015-01-13 19:54 ` Russell King - ARM Linux 2015-01-13 19:54 ` Russell King - ARM Linux 2015-01-14 7:55 ` Jean-Francois Moine 2015-01-14 7:55 ` Jean-Francois Moine 2015-01-14 12:12 ` Russell King - ARM Linux 2015-01-14 12:12 ` Russell King - ARM Linux 2015-01-14 10:46 ` Philipp Zabel 2015-01-14 10:46 ` Philipp Zabel 2015-01-14 12:50 ` Mark Brown 2015-01-14 12:50 ` Mark Brown 2015-01-14 14:23 ` Russell King - ARM Linux 2015-01-14 14:23 ` Russell King - ARM Linux 2015-01-07 10:00 ` [PATCH v9 2/4] drm/i2c: tda998x: Change drvdata for audio extension Jean-Francois Moine 2015-01-07 10:00 ` Jean-Francois Moine 2015-01-07 10:51 ` [PATCH v9 3/4] ASoC: tda998x: add a codec to the HDMI transmitter Jean-Francois Moine 2015-01-07 15:10 ` Andrew Jackson 2015-01-07 15:10 ` Andrew Jackson 2015-01-07 15:41 ` Russell King - ARM Linux 2015-01-07 15:41 ` Russell King - ARM Linux 2015-01-07 18:02 ` Jean-Francois Moine 2015-01-09 10:24 ` Jyri Sarha 2015-01-09 10:24 ` Jyri Sarha 2015-01-09 11:15 ` Jean-Francois Moine 2015-01-09 11:15 ` Jean-Francois Moine 2015-01-09 11:19 ` Russell King - ARM Linux 2015-01-09 11:19 ` Russell King - ARM Linux 2015-01-09 11:45 ` Jean-Francois Moine 2015-01-09 11:45 ` Jean-Francois Moine 2015-01-09 11:48 ` Russell King - ARM Linux 2015-01-09 11:48 ` Russell King - ARM Linux 2015-01-07 17:34 ` Mark Brown 2015-01-07 17:34 ` Mark Brown 2015-01-08 14:55 ` Jyri Sarha 2015-01-08 14:55 ` Jyri Sarha 2015-01-09 17:39 ` Andrew Jackson 2015-01-09 17:39 ` Andrew Jackson 2015-01-09 17:54 ` Mark Brown 2015-01-09 17:54 ` Mark Brown 2015-01-13 9:24 ` Jean-Francois Moine 2015-01-13 9:24 ` Jean-Francois Moine 2015-01-11 21:03 ` Jyri Sarha 2015-01-11 21:03 ` Jyri Sarha 2015-01-13 7:41 ` Jean-Francois Moine 2015-01-13 7:41 ` Jean-Francois Moine 2015-01-07 11:01 ` [PATCH v9 4/4] drm/i2c: tda998x: set cts_n according to the sample width Jean-Francois Moine 2015-01-08 14:53 ` [PATCH v9 0/4] ASoC: tda998x: add a codec to the HDMI transmitter Jyri Sarha 2015-01-08 14:53 ` Jyri Sarha 2015-01-08 20:05 ` Mark Brown 2015-01-09 10:15 ` Jyri Sarha 2015-01-09 10:15 ` Jyri Sarha
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=54AD4511.30702@arm.com \ --to=andrew.jackson@arm.com \ --cc=airlied@gmail.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=devicetree@vger.kernel.org \ --cc=dri-devel@lists.freedesktop.org \ --cc=jsarha@ti.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux@arm.linux.org.uk \ --cc=moinejf@free.fr \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.