From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Jean-Francois Moine <moinejf@free.fr>
Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>,
dri-devel@lists.freedesktop.org, David Airlie <airlied@linux.ie>,
Darren Etheridge <darren.etheridge@gmail.com>,
Rob Clark <robdclark@gmail.com>, Daniel Vetter <daniel@ffwll.ch>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 5/8] drm/i2c: tda998x: add video and audio input configuration
Date: Wed, 21 Aug 2013 23:41:27 +0100 [thread overview]
Message-ID: <20130821224126.GB6617@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20130821203355.5bbc69d1@armhf>
On Wed, Aug 21, 2013 at 08:33:55PM +0200, Jean-Francois Moine wrote:
> On Wed Aug 14 12:43:30 PDT 2013, Sebastian Hesselbarth wrote:
> > +static void
> > +reg_write_range(struct drm_encoder *encoder, uint16_t reg, uint8_t *p, int cnt)
> > +{
> > + struct i2c_client *client = drm_i2c_encoder_get_client(encoder);
> > + uint8_t buf[cnt+1];
> > + int ret;
> > +
> > + buf[0] = REG2ADDR(reg);
> > + memcpy(&buf[1], p, cnt);
> > +
> > + set_page(encoder, reg);
> > +
> > + ret = i2c_master_send(client, buf, cnt + 1);
> > + if (ret < 0)
> > + dev_err(&client->dev, "Error %d writing to 0x%x\n", ret, reg);
> > +}
> > +
>
> It seems simpler to reserve one byte in the caller buffer for the
> register address and avoid a memcpy.
And by doing so create an obtuse API. No thanks.
> > +static void
> > +tda998x_write_aif(struct drm_encoder *encoder, struct tda998x_encoder_params *p)
> > +{
> > + uint8_t buf[PB(5) + 1];
> > +
> > + buf[HB(0)] = 0x84;
> > + buf[HB(1)] = 0x01;
> > + buf[HB(2)] = 10;
>
> Why don't you use the constants which are defined in hdmi.h?
Because I was not aware of them.
> > + /* Write the CTS and N values */
> > + buf[0] = 0x44;
> > + buf[1] = 0x42;
> > + buf[2] = 0x01;
>
> The CTS value is strange, but that does not matter: its generation is
> automatic (see above).
Correct - however not strange, if you've read the HDMI specification.
> > + buf[3] = n;
> > + buf[4] = n >> 8;
> > + buf[5] = n >> 16;
> > + reg_write_range(encoder, REG_ACR_CTS_0, buf, 6);
> > +
> > + /* Set CTS clock reference */
> > + reg_write(encoder, REG_AIP_CLKSEL, clksel_aip | clksel_fs);
> > +
> > + /* Reset CTS generator */
> > + reg_set(encoder, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_CTS);
> > + reg_clear(encoder, REG_AIP_CNTRL_0, AIP_CNTRL_0_RST_CTS);
> > +
> > + /* Write the channel status */
> > + buf[0] = 0x04;
> > + buf[1] = 0x00;
> > + buf[2] = 0x00;
> > + buf[3] = 0xf1;
> > + reg_write_range(encoder, REG_CH_STAT_B(0), buf, 4);
> [snip]
>
> From what I understood in the NXP driver, buf[3] depends on the sample
> rate: 0xf1 for 44.1kHz and 0xd1 for 48kHz.
Correct, but the driver has no way to know this. The above reflects how
the NXP driver on the Cubox implements this (which we know works for
multiple different sample rates). This is because we use SPDIF, which
encodes the sample rate in the channel status information, which is then
presumably passed through by the TDA998x. I wouldn't know, I don't have
a HDMI debugger.
What I do know is that it works for multiple sample rates.
next prev parent reply other threads:[~2013-08-21 22:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-21 18:33 Jean-Francois Moine
2013-08-21 22:41 ` Russell King - ARM Linux [this message]
-- strict thread matches above, loose matches on Subject: below --
2013-08-14 19:43 [PATCH v2 0/8] Several NXP TDA998x patches Sebastian Hesselbarth
2013-08-14 19:43 ` [PATCH v2 5/8] drm/i2c: tda998x: add video and audio input configuration Sebastian Hesselbarth
2013-08-18 23:23 ` Dave Airlie
2013-08-18 23:29 ` Russell King - ARM Linux
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=20130821224126.GB6617@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=airlied@linux.ie \
--cc=daniel@ffwll.ch \
--cc=darren.etheridge@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=moinejf@free.fr \
--cc=robdclark@gmail.com \
--cc=sebastian.hesselbarth@gmail.com \
/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: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®