.. | .. |
---|
1527 | 1527 | v4l2_find_dv_timings_cap(timings, adv7842_get_dv_timings_cap(sd), |
---|
1528 | 1528 | is_digital_input(sd) ? 250000 : 1000000, |
---|
1529 | 1529 | adv7842_check_dv_timings, NULL); |
---|
| 1530 | + timings->bt.flags |= V4L2_DV_FL_CAN_DETECT_REDUCED_FPS; |
---|
1530 | 1531 | } |
---|
1531 | 1532 | |
---|
1532 | 1533 | static int adv7842_query_dv_timings(struct v4l2_subdev *sd, |
---|
.. | .. |
---|
1598 | 1599 | bt->il_vbackporch = 0; |
---|
1599 | 1600 | } |
---|
1600 | 1601 | adv7842_fill_optional_dv_timings_fields(sd, timings); |
---|
| 1602 | + if ((timings->bt.flags & V4L2_DV_FL_CAN_REDUCE_FPS) && |
---|
| 1603 | + freq < bt->pixelclock) { |
---|
| 1604 | + u32 reduced_freq = ((u32)bt->pixelclock / 1001) * 1000; |
---|
| 1605 | + u32 delta_freq = abs(freq - reduced_freq); |
---|
| 1606 | + |
---|
| 1607 | + if (delta_freq < ((u32)bt->pixelclock - reduced_freq) / 2) |
---|
| 1608 | + timings->bt.flags |= V4L2_DV_FL_REDUCED_FPS; |
---|
| 1609 | + } |
---|
1601 | 1610 | } else { |
---|
1602 | 1611 | /* find format |
---|
1603 | 1612 | * Since LCVS values are inaccurate [REF_03, p. 339-340], |
---|
.. | .. |
---|
2538 | 2547 | u8 payload_addr; |
---|
2539 | 2548 | }; |
---|
2540 | 2549 | |
---|
2541 | | -static void log_infoframe(struct v4l2_subdev *sd, struct adv7842_cfg_read_infoframe *cri) |
---|
| 2550 | +static void log_infoframe(struct v4l2_subdev *sd, const struct adv7842_cfg_read_infoframe *cri) |
---|
2542 | 2551 | { |
---|
2543 | 2552 | int i; |
---|
2544 | 2553 | u8 buffer[32]; |
---|
.. | .. |
---|
2565 | 2574 | for (i = 0; i < len; i++) |
---|
2566 | 2575 | buffer[i + 3] = infoframe_read(sd, cri->payload_addr + i); |
---|
2567 | 2576 | |
---|
2568 | | - if (hdmi_infoframe_unpack(&frame, buffer, sizeof(buffer)) < 0) { |
---|
| 2577 | + if (hdmi_infoframe_unpack(&frame, buffer, len + 3) < 0) { |
---|
2569 | 2578 | v4l2_err(sd, "%s: unpack of %s infoframe failed\n", __func__, cri->desc); |
---|
2570 | 2579 | return; |
---|
2571 | 2580 | } |
---|
.. | .. |
---|
2576 | 2585 | static void adv7842_log_infoframes(struct v4l2_subdev *sd) |
---|
2577 | 2586 | { |
---|
2578 | 2587 | int i; |
---|
2579 | | - struct adv7842_cfg_read_infoframe cri[] = { |
---|
| 2588 | + static const struct adv7842_cfg_read_infoframe cri[] = { |
---|
2580 | 2589 | { "AVI", 0x01, 0xe0, 0x00 }, |
---|
2581 | 2590 | { "Audio", 0x02, 0xe3, 0x1c }, |
---|
2582 | 2591 | { "SDP", 0x04, 0xe6, 0x2a }, |
---|
.. | .. |
---|
3093 | 3102 | |
---|
3094 | 3103 | io_write(sd, 0x00, 0x01); /* Program SDP 4x1 */ |
---|
3095 | 3104 | io_write(sd, 0x01, 0x00); /* Program SDP mode */ |
---|
3096 | | - afe_write(sd, 0x80, 0x92); /* SDP Recommeneded Write */ |
---|
3097 | | - afe_write(sd, 0x9B, 0x01); /* SDP Recommeneded Write ADV7844ES1 */ |
---|
3098 | | - afe_write(sd, 0x9C, 0x60); /* SDP Recommeneded Write ADV7844ES1 */ |
---|
3099 | | - afe_write(sd, 0x9E, 0x02); /* SDP Recommeneded Write ADV7844ES1 */ |
---|
3100 | | - afe_write(sd, 0xA0, 0x0B); /* SDP Recommeneded Write ADV7844ES1 */ |
---|
| 3105 | + afe_write(sd, 0x80, 0x92); /* SDP Recommended Write */ |
---|
| 3106 | + afe_write(sd, 0x9B, 0x01); /* SDP Recommended Write ADV7844ES1 */ |
---|
| 3107 | + afe_write(sd, 0x9C, 0x60); /* SDP Recommended Write ADV7844ES1 */ |
---|
| 3108 | + afe_write(sd, 0x9E, 0x02); /* SDP Recommended Write ADV7844ES1 */ |
---|
| 3109 | + afe_write(sd, 0xA0, 0x0B); /* SDP Recommended Write ADV7844ES1 */ |
---|
3101 | 3110 | afe_write(sd, 0xC3, 0x02); /* Memory BIST Initialisation */ |
---|
3102 | 3111 | io_write(sd, 0x0C, 0x40); /* Power up ADV7844 */ |
---|
3103 | 3112 | io_write(sd, 0x15, 0xBA); /* Enable outputs */ |
---|
.. | .. |
---|
3342 | 3351 | static void adv7842_unregister_clients(struct v4l2_subdev *sd) |
---|
3343 | 3352 | { |
---|
3344 | 3353 | struct adv7842_state *state = to_state(sd); |
---|
3345 | | - if (state->i2c_avlink) |
---|
3346 | | - i2c_unregister_device(state->i2c_avlink); |
---|
3347 | | - if (state->i2c_cec) |
---|
3348 | | - i2c_unregister_device(state->i2c_cec); |
---|
3349 | | - if (state->i2c_infoframe) |
---|
3350 | | - i2c_unregister_device(state->i2c_infoframe); |
---|
3351 | | - if (state->i2c_sdp_io) |
---|
3352 | | - i2c_unregister_device(state->i2c_sdp_io); |
---|
3353 | | - if (state->i2c_sdp) |
---|
3354 | | - i2c_unregister_device(state->i2c_sdp); |
---|
3355 | | - if (state->i2c_afe) |
---|
3356 | | - i2c_unregister_device(state->i2c_afe); |
---|
3357 | | - if (state->i2c_repeater) |
---|
3358 | | - i2c_unregister_device(state->i2c_repeater); |
---|
3359 | | - if (state->i2c_edid) |
---|
3360 | | - i2c_unregister_device(state->i2c_edid); |
---|
3361 | | - if (state->i2c_hdmi) |
---|
3362 | | - i2c_unregister_device(state->i2c_hdmi); |
---|
3363 | | - if (state->i2c_cp) |
---|
3364 | | - i2c_unregister_device(state->i2c_cp); |
---|
3365 | | - if (state->i2c_vdp) |
---|
3366 | | - i2c_unregister_device(state->i2c_vdp); |
---|
| 3354 | + i2c_unregister_device(state->i2c_avlink); |
---|
| 3355 | + i2c_unregister_device(state->i2c_cec); |
---|
| 3356 | + i2c_unregister_device(state->i2c_infoframe); |
---|
| 3357 | + i2c_unregister_device(state->i2c_sdp_io); |
---|
| 3358 | + i2c_unregister_device(state->i2c_sdp); |
---|
| 3359 | + i2c_unregister_device(state->i2c_afe); |
---|
| 3360 | + i2c_unregister_device(state->i2c_repeater); |
---|
| 3361 | + i2c_unregister_device(state->i2c_edid); |
---|
| 3362 | + i2c_unregister_device(state->i2c_hdmi); |
---|
| 3363 | + i2c_unregister_device(state->i2c_cp); |
---|
| 3364 | + i2c_unregister_device(state->i2c_vdp); |
---|
3367 | 3365 | |
---|
3368 | 3366 | state->i2c_avlink = NULL; |
---|
3369 | 3367 | state->i2c_cec = NULL; |
---|
.. | .. |
---|
3391 | 3389 | return NULL; |
---|
3392 | 3390 | } |
---|
3393 | 3391 | |
---|
3394 | | - cp = i2c_new_dummy(client->adapter, io_read(sd, io_reg) >> 1); |
---|
3395 | | - if (!cp) |
---|
3396 | | - v4l2_err(sd, "register %s on i2c addr 0x%x failed\n", desc, addr); |
---|
| 3392 | + cp = i2c_new_dummy_device(client->adapter, io_read(sd, io_reg) >> 1); |
---|
| 3393 | + if (IS_ERR(cp)) { |
---|
| 3394 | + v4l2_err(sd, "register %s on i2c addr 0x%x failed with %ld\n", |
---|
| 3395 | + desc, addr, PTR_ERR(cp)); |
---|
| 3396 | + cp = NULL; |
---|
| 3397 | + } |
---|
3397 | 3398 | |
---|
3398 | 3399 | return cp; |
---|
3399 | 3400 | } |
---|