Skip to content

Commit aa57e96

Browse files
committed
Revert "media: i2c: imx477: Add option for double link frequency (900MHz)"
This reverts commit 7487862.
1 parent 1279f50 commit aa57e96

File tree

1 file changed

+11
-45
lines changed

1 file changed

+11
-45
lines changed

drivers/media/i2c/imx477.c

Lines changed: 11 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ MODULE_PARM_DESC(trigger_mode, "Set vsync trigger mode: 1=source, 2=sink");
8686
#define IMX477_DGTL_GAIN_DEFAULT 0x0100
8787
#define IMX477_DGTL_GAIN_STEP 1
8888

89-
#define IMX477_REG_DIV_IOP_PX 0x030b
90-
9189
/* Test Pattern Control */
9290
#define IMX477_REG_TEST_PATTERN 0x0600
9391
#define IMX477_TEST_PATTERN_DISABLE 0
@@ -156,7 +154,7 @@ struct imx477_mode {
156154
/* Frame height */
157155
unsigned int height;
158156

159-
/* H-timing in pixels when at 450MHz link freq */
157+
/* H-timing in pixels */
160158
unsigned int line_length_pix;
161159

162160
/* Analog crop rectangle. */
@@ -179,7 +177,7 @@ enum {
179177
IMX477_LINK_FREQ_498MHZ,
180178
};
181179

182-
static const u64 imx477_link_freq_menu[] = {
180+
static const s64 link_freqs[] = {
183181
[IMX477_LINK_FREQ_450MHZ] = 450000000,
184182
[IMX477_LINK_FREQ_453MHZ] = 453000000,
185183
[IMX477_LINK_FREQ_456MHZ] = 456000000,
@@ -188,12 +186,6 @@ static const u64 imx477_link_freq_menu[] = {
188186
[IMX477_LINK_FREQ_498MHZ] = 498000000,
189187
};
190188

191-
static const u64 imx477_double_link_freq_menu[] = {
192-
[IMX477_LINK_FREQ_450MHZ] = 450000000 * 2,
193-
[IMX477_LINK_FREQ_453MHZ] = 453000000 * 2,
194-
[IMX477_LINK_FREQ_456MHZ] = 456000000 * 2,
195-
};
196-
197189
/* 450MHz is the nominal "default" link frequency */
198190
static const struct imx477_reg link_450Mhz_regs[] = {
199191
{0x030E, 0x00},
@@ -576,6 +568,7 @@ static const struct imx477_reg mode_common_regs[] = {
576568
{0x9e9f, 0x00},
577569
{0x0301, 0x05},
578570
{0x0303, 0x02},
571+
{0x030b, 0x02},
579572
{0x030d, 0x02},
580573
{0x0310, 0x01},
581574
{0x0820, 0x07},
@@ -868,7 +861,7 @@ static const struct imx477_mode supported_modes_12bit[] = {
868861
/* 12MPix 10fps mode */
869862
.width = 4056,
870863
.height = 3040,
871-
.line_length_pix = 24000,
864+
.line_length_pix = 0x5dc0,
872865
.crop = {
873866
.left = IMX477_PIXEL_ARRAY_LEFT,
874867
.top = IMX477_PIXEL_ARRAY_TOP,
@@ -885,7 +878,7 @@ static const struct imx477_mode supported_modes_12bit[] = {
885878
/* 2x2 binned 40fps mode */
886879
.width = 2028,
887880
.height = 1520,
888-
.line_length_pix = 12740,
881+
.line_length_pix = 0x31c4,
889882
.crop = {
890883
.left = IMX477_PIXEL_ARRAY_LEFT,
891884
.top = IMX477_PIXEL_ARRAY_TOP,
@@ -902,7 +895,7 @@ static const struct imx477_mode supported_modes_12bit[] = {
902895
/* 1080p 50fps cropped mode */
903896
.width = 2028,
904897
.height = 1080,
905-
.line_length_pix = 12740,
898+
.line_length_pix = 0x31c4,
906899
.crop = {
907900
.left = IMX477_PIXEL_ARRAY_LEFT,
908901
.top = IMX477_PIXEL_ARRAY_TOP + 440,
@@ -1053,12 +1046,6 @@ struct imx477 {
10531046
*/
10541047
unsigned int csi2_flags;
10551048

1056-
/*
1057-
* Flag that CSI2 link is running at twice IMX477_DEFAULT_LINK_FREQ.
1058-
* line_length_pix can be halved in that case.
1059-
*/
1060-
bool double_link_freq;
1061-
10621049
/* Rewrite common registers on stream on? */
10631050
bool common_regs_written;
10641051

@@ -1509,7 +1496,6 @@ static void imx477_set_framing_limits(struct imx477 *imx477)
15091496
{
15101497
unsigned int frm_length_default, hblank_min;
15111498
const struct imx477_mode *mode = imx477->mode;
1512-
unsigned int line_length_pix;
15131499

15141500
frm_length_default =
15151501
imx477_get_frame_length(mode, mode->framerate_default);
@@ -1526,10 +1512,7 @@ static void imx477_set_framing_limits(struct imx477 *imx477)
15261512
/* Setting this will adjust the exposure limits as well. */
15271513
__v4l2_ctrl_s_ctrl(imx477->vblank, frm_length_default - mode->height);
15281514

1529-
line_length_pix = mode->line_length_pix;
1530-
if (imx477->double_link_freq)
1531-
line_length_pix /= 2;
1532-
hblank_min = line_length_pix - mode->width;
1515+
hblank_min = mode->line_length_pix - mode->width;
15331516
__v4l2_ctrl_modify_range(imx477->hblank, hblank_min,
15341517
IMX477_LINE_LENGTH_MAX, 1, hblank_min);
15351518
__v4l2_ctrl_s_ctrl(imx477->hblank, hblank_min);
@@ -1676,10 +1659,6 @@ static int imx477_start_streaming(struct imx477 *imx477)
16761659
imx477->csi2_flags & V4L2_MBUS_CSI2_NONCONTINUOUS_CLOCK ?
16771660
1 : 0);
16781661

1679-
imx477_write_reg(imx477, IMX477_REG_DIV_IOP_PX,
1680-
IMX477_REG_VALUE_08BIT,
1681-
imx477->double_link_freq ? 1 : 2);
1682-
16831662
imx477->common_regs_written = true;
16841663
}
16851664

@@ -1947,7 +1926,6 @@ static int imx477_init_controls(struct imx477 *imx477)
19471926
struct v4l2_ctrl_handler *ctrl_hdlr;
19481927
struct i2c_client *client = v4l2_get_subdevdata(&imx477->sd);
19491928
struct v4l2_fwnode_device_properties props;
1950-
const u64 *link_freq_menu;
19511929
unsigned int i;
19521930
int ret;
19531931

@@ -1969,15 +1947,10 @@ static int imx477_init_controls(struct imx477 *imx477)
19691947
imx477->pixel_rate->flags |= V4L2_CTRL_FLAG_READ_ONLY;
19701948

19711949
/* LINK_FREQ is also read only */
1972-
if (imx477->double_link_freq)
1973-
link_freq_menu = &imx477_double_link_freq_menu[imx477->link_freq_idx];
1974-
else
1975-
link_freq_menu = &imx477_link_freq_menu[imx477->link_freq_idx];
1976-
19771950
imx477->link_freq =
19781951
v4l2_ctrl_new_int_menu(ctrl_hdlr, &imx477_ctrl_ops,
19791952
V4L2_CID_LINK_FREQ, 0, 0,
1980-
link_freq_menu);
1953+
&link_freqs[imx477->link_freq_idx]);
19811954
if (imx477->link_freq)
19821955
imx477->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
19831956

@@ -2107,21 +2080,14 @@ static int imx477_check_hwcfg(struct device *dev, struct imx477 *imx477)
21072080
goto error_out;
21082081
}
21092082

2110-
for (i = 0; i < ARRAY_SIZE(imx477_link_freq_menu); i++) {
2111-
if (imx477_link_freq_menu[i] == ep_cfg.link_frequencies[0] ||
2112-
imx477_double_link_freq_menu[i] ==
2113-
ep_cfg.link_frequencies[0]) {
2083+
for (i = 0; i < ARRAY_SIZE(link_freqs); i++) {
2084+
if (link_freqs[i] == ep_cfg.link_frequencies[0]) {
21142085
imx477->link_freq_idx = i;
2115-
2116-
if (imx477_double_link_freq_menu[i] ==
2117-
ep_cfg.link_frequencies[0])
2118-
imx477->double_link_freq = true;
2119-
21202086
break;
21212087
}
21222088
}
21232089

2124-
if (i == ARRAY_SIZE(imx477_link_freq_menu)) {
2090+
if (i == ARRAY_SIZE(link_freqs)) {
21252091
dev_err(dev, "Link frequency not supported: %lld\n",
21262092
ep_cfg.link_frequencies[0]);
21272093
ret = -EINVAL;

0 commit comments

Comments
 (0)