From: Tomasz Stanislawski <t.stanislaws@samsung.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org,
Prabhakar Lad <prabhakar.csengg@gmail.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
Scott Jiang <scott.jiang.linux@gmail.com>,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [RFC PATCH 10/18] s5p-tv: add dv_timings support for hdmiphy.
Date: Fri, 01 Mar 2013 12:02:14 +0100 [thread overview]
Message-ID: <51308AB6.3090309@samsung.com> (raw)
In-Reply-To: <c1ace44350055629138909c9a16a566f36add130.1361006882.git.hans.verkuil@cisco.com>
Hi Hans,
Please refer to the comments below.
On 02/16/2013 10:28 AM, Hans Verkuil wrote:
> From: Hans Verkuil <hans.verkuil@cisco.com>
>
> This just adds dv_timings support without modifying existing dv_preset
> support, although I had to refactor a little bit in order to share
> hdmiphy_find_conf() between the preset and timings code.
>
> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> Cc: Tomasz Stanislawski <t.stanislaws@samsung.com>
> Cc: Kyungmin Park <kyungmin.park@samsung.com>
> ---
> drivers/media/platform/s5p-tv/hdmiphy_drv.c | 48 ++++++++++++++++++++++-----
> 1 file changed, 39 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/media/platform/s5p-tv/hdmiphy_drv.c b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
> index 80717ce..85b4211 100644
> --- a/drivers/media/platform/s5p-tv/hdmiphy_drv.c
> +++ b/drivers/media/platform/s5p-tv/hdmiphy_drv.c
> @@ -197,14 +197,9 @@ static unsigned long hdmiphy_preset_to_pixclk(u32 preset)
> return 0;
> }
>
> -static const u8 *hdmiphy_find_conf(u32 preset, const struct hdmiphy_conf *conf)
> +static const u8 *hdmiphy_find_conf(unsigned long pixclk,
> + const struct hdmiphy_conf *conf)
> {
> - unsigned long pixclk;
> -
> - pixclk = hdmiphy_preset_to_pixclk(preset);
> - if (!pixclk)
> - return NULL;
> -
> for (; conf->pixclk; ++conf)
> if (conf->pixclk == pixclk)
> return conf->data;
> @@ -220,15 +215,49 @@ static int hdmiphy_s_power(struct v4l2_subdev *sd, int on)
> static int hdmiphy_s_dv_preset(struct v4l2_subdev *sd,
> struct v4l2_dv_preset *preset)
> {
> - const u8 *data;
> + const u8 *data = NULL;
> u8 buffer[32];
> int ret;
> struct hdmiphy_ctx *ctx = sd_to_ctx(sd);
> struct i2c_client *client = v4l2_get_subdevdata(sd);
> + unsigned long pixclk;
> struct device *dev = &client->dev;
>
> dev_info(dev, "s_dv_preset(preset = %d)\n", preset->preset);
> - data = hdmiphy_find_conf(preset->preset, ctx->conf_tab);
> +
> + pixclk = hdmiphy_preset_to_pixclk(preset->preset);
Just nitpicking.
The pixclk might be 0 is the preset is not supported hdmiphy.
For some platforms not all frequencies are supported.
Anyway, if pixclk is 0 then hdmiphy_find_conf will detect it.
> + data = hdmiphy_find_conf(pixclk, ctx->conf_tab);
> + if (!data) {
> + dev_err(dev, "format not supported\n");
> + return -EINVAL;
> + }
> +
> + /* storing configuration to the device */
> + memcpy(buffer, data, 32);
> + ret = i2c_master_send(client, buffer, 32);
> + if (ret != 32) {
> + dev_err(dev, "failed to configure HDMIPHY via I2C\n");
> + return -EIO;
> + }
> +
> + return 0;
> +}
> +
> +static int hdmiphy_s_dv_timings(struct v4l2_subdev *sd,
> + struct v4l2_dv_timings *timings)
> +{
> + const u8 *data;
> + u8 buffer[32];
> + int ret;
> + struct hdmiphy_ctx *ctx = sd_to_ctx(sd);
> + struct i2c_client *client = v4l2_get_subdevdata(sd);
> + struct device *dev = &client->dev;
> + unsigned long pixclk = timings->bt.pixelclock;
> +
> + dev_info(dev, "s_dv_timings\n");
Using test against V4L2_DV_FL_REDUCED_FPS and 74250000 looks little hacky to me.
Why there is no such a check for 148500000 and 27000000 (REDUCED -> INCREASED?).
Maybe it will be better to past both timings->bt.pixelclock and timings->bt.flags
as parameters for hdmiphy_find_conf function. The hdmiphy_find_conf could
perform pixclk adjustment or some fallback policy based on the flags.
> + if ((timings->bt.flags & V4L2_DV_FL_REDUCED_FPS) && pixclk == 74250000)
> + pixclk = 74176000;
> + data = hdmiphy_find_conf(pixclk, ctx->conf_tab);
> if (!data) {
> dev_err(dev, "format not supported\n");
> return -EINVAL;
> @@ -271,6 +300,7 @@ static const struct v4l2_subdev_core_ops hdmiphy_core_ops = {
>
> static const struct v4l2_subdev_video_ops hdmiphy_video_ops = {
> .s_dv_preset = hdmiphy_s_dv_preset,
> + .s_dv_timings = hdmiphy_s_dv_timings,
> .s_stream = hdmiphy_s_stream,
> };
>
>
next prev parent reply other threads:[~2013-03-01 11:02 UTC|newest]
Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-16 9:28 [RFC PATCH 00/18] Remove DV_PRESET API Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 01/18] tvp7002: replace 'preset' by 'timings' in various structs/variables Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 02/18] tvp7002: use dv_timings structs instead of presets Hans Verkuil
2013-02-16 13:12 ` Prabhakar Lad
2013-02-16 9:28 ` [RFC PATCH 03/18] tvp7002: remove dv_preset support Hans Verkuil
2013-02-16 13:13 ` Prabhakar Lad
2013-02-16 9:28 ` [RFC PATCH 04/18] davinci_vpfe: fix copy-paste errors in several comments Hans Verkuil
2013-02-16 12:40 ` Prabhakar Lad
2013-02-16 9:28 ` [RFC PATCH 05/18] davinci: remove VPBE_ENC_DV_PRESET and rename VPBE_ENC_CUSTOM_TIMINGS Hans Verkuil
2013-02-16 12:50 ` Prabhakar Lad
2013-02-16 19:18 ` Sekhar Nori
2013-02-16 9:28 ` [RFC PATCH 06/18] davinci: replace V4L2_OUT_CAP_CUSTOM_TIMINGS by V4L2_OUT_CAP_DV_TIMINGS Hans Verkuil
2013-02-16 12:58 ` Prabhakar Lad
2013-02-16 19:23 ` Sekhar Nori
2013-02-16 19:33 ` Hans Verkuil
2013-02-19 10:47 ` Sekhar Nori
2013-02-16 9:28 ` [RFC PATCH 07/18] blackfin: replace V4L2_IN/OUT_CAP_CUSTOM_TIMINGS by DV_TIMINGS Hans Verkuil
2013-02-16 13:39 ` Scott Jiang
2013-02-16 9:28 ` [RFC PATCH 08/18] s5p-tv: add dv_timings support for mixer_video Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 09/18] s5p-tv: add dv_timings support for hdmi Hans Verkuil
2013-03-01 11:01 ` Tomasz Stanislawski
2013-02-16 9:28 ` [RFC PATCH 10/18] s5p-tv: add dv_timings support for hdmiphy Hans Verkuil
2013-03-01 11:02 ` Tomasz Stanislawski [this message]
2013-03-01 11:25 ` Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 11/18] s5p-tv: remove dv_preset support from mixer_video Hans Verkuil
2013-03-01 11:02 ` Tomasz Stanislawski
2013-02-16 9:28 ` [RFC PATCH 12/18] s5p-tv: remove the dv_preset API from hdmi Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 13/18] s5p-tv: remove the dv_preset API from hdmiphy Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 14/18] v4l2-common: remove obsolete v4l_fill_dv_preset_info Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 15/18] v4l2-subdev: remove obsolete dv_preset ops Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 16/18] v4l2 core: remove the obsolete dv_preset support Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 17/18] DocBook/media/v4l: remove the documentation of the obsolete dv_preset API Hans Verkuil
2013-02-16 9:28 ` [RFC PATCH 18/18] videodev2.h: remove obsolete DV_PRESET API Hans Verkuil
2013-02-16 13:12 ` [RFC PATCH 01/18] tvp7002: replace 'preset' by 'timings' in various structs/variables Prabhakar Lad
2013-03-01 11:01 ` [RFC PATCH 00/18] Remove DV_PRESET API Tomasz Stanislawski
2013-03-01 11:32 ` Hans Verkuil
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=51308AB6.3090309@samsung.com \
--to=t.stanislaws@samsung.com \
--cc=hans.verkuil@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=kyungmin.park@samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=prabhakar.csengg@gmail.com \
--cc=scott.jiang.linux@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;
as well as URLs for NNTP newsgroup(s).