Commit 961f97ab authored by Dragos Bogdan's avatar Dragos Bogdan Committed by Mauro Carvalho Chehab

media: adv7604: extend deep color mode to ADV7611

The AD7611 chip supports the same Deep Color Mode settings as the AD7604.
This change extends support for this feature to the AD7611 by adding a
wrapper function for the `read_hdmi_pixelclock` hook and adding the same
frequency adjustment logic.
Signed-off-by: default avatarDragos Bogdan <dragos.bogdan@analog.com>
Signed-off-by: default avatarAlexandru Ardelean <alexandru.ardelean@analog.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 69e39d40
...@@ -1503,23 +1503,14 @@ static void adv76xx_fill_optional_dv_timings_fields(struct v4l2_subdev *sd, ...@@ -1503,23 +1503,14 @@ static void adv76xx_fill_optional_dv_timings_fields(struct v4l2_subdev *sd,
static unsigned int adv7604_read_hdmi_pixelclock(struct v4l2_subdev *sd) static unsigned int adv7604_read_hdmi_pixelclock(struct v4l2_subdev *sd)
{ {
unsigned int freq;
int a, b; int a, b;
a = hdmi_read(sd, 0x06); a = hdmi_read(sd, 0x06);
b = hdmi_read(sd, 0x3b); b = hdmi_read(sd, 0x3b);
if (a < 0 || b < 0) if (a < 0 || b < 0)
return 0; return 0;
freq = a * 1000000 + ((b & 0x30) >> 4) * 250000;
if (is_hdmi(sd)) { return a * 1000000 + ((b & 0x30) >> 4) * 250000;
/* adjust for deep color mode */
unsigned bits_per_channel = ((hdmi_read(sd, 0x0b) & 0x60) >> 4) + 8;
freq = freq * 8 / bits_per_channel;
}
return freq;
} }
static unsigned int adv7611_read_hdmi_pixelclock(struct v4l2_subdev *sd) static unsigned int adv7611_read_hdmi_pixelclock(struct v4l2_subdev *sd)
...@@ -1530,9 +1521,28 @@ static unsigned int adv7611_read_hdmi_pixelclock(struct v4l2_subdev *sd) ...@@ -1530,9 +1521,28 @@ static unsigned int adv7611_read_hdmi_pixelclock(struct v4l2_subdev *sd)
b = hdmi_read(sd, 0x52); b = hdmi_read(sd, 0x52);
if (a < 0 || b < 0) if (a < 0 || b < 0)
return 0; return 0;
return ((a << 1) | (b >> 7)) * 1000000 + (b & 0x7f) * 1000000 / 128; return ((a << 1) | (b >> 7)) * 1000000 + (b & 0x7f) * 1000000 / 128;
} }
static unsigned int adv76xx_read_hdmi_pixelclock(struct v4l2_subdev *sd)
{
struct adv76xx_state *state = to_state(sd);
const struct adv76xx_chip_info *info = state->info;
unsigned int freq, bits_per_channel, pixelrepetition;
freq = info->read_hdmi_pixelclock(sd);
if (is_hdmi(sd)) {
/* adjust for deep color mode and pixel repetition */
bits_per_channel = ((hdmi_read(sd, 0x0b) & 0x60) >> 4) + 8;
pixelrepetition = (hdmi_read(sd, 0x05) & 0x0f) + 1;
freq = freq * 8 / bits_per_channel / pixelrepetition;
}
return freq;
}
static int adv76xx_query_dv_timings(struct v4l2_subdev *sd, static int adv76xx_query_dv_timings(struct v4l2_subdev *sd,
struct v4l2_dv_timings *timings) struct v4l2_dv_timings *timings)
{ {
...@@ -1579,7 +1589,7 @@ static int adv76xx_query_dv_timings(struct v4l2_subdev *sd, ...@@ -1579,7 +1589,7 @@ static int adv76xx_query_dv_timings(struct v4l2_subdev *sd,
bt->width = w; bt->width = w;
bt->height = h; bt->height = h;
bt->pixelclock = info->read_hdmi_pixelclock(sd); bt->pixelclock = adv76xx_read_hdmi_pixelclock(sd);
bt->hfrontporch = hdmi_read16(sd, 0x20, info->hfrontporch_mask); bt->hfrontporch = hdmi_read16(sd, 0x20, info->hfrontporch_mask);
bt->hsync = hdmi_read16(sd, 0x22, info->hsync_mask); bt->hsync = hdmi_read16(sd, 0x22, info->hsync_mask);
bt->hbackporch = hdmi_read16(sd, 0x24, info->hbackporch_mask); bt->hbackporch = hdmi_read16(sd, 0x24, info->hbackporch_mask);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment