.. | .. |
---|
491 | 491 | mutex_lock(&bt1120->confctl_mutex); |
---|
492 | 492 | bt1120->avi_rcv_rdy = false; |
---|
493 | 493 | plugin = tx_5v_power_present(sd); |
---|
| 494 | + v4l2_ctrl_s_ctrl(bt1120->detect_tx_5v_ctrl, plugin); |
---|
494 | 495 | v4l2_dbg(1, debug, sd, "%s: 5v_det:%d\n", __func__, plugin); |
---|
495 | 496 | if (plugin) { |
---|
496 | 497 | rk628_set_io_func_to_vop(bt1120->rk628); |
---|
.. | .. |
---|
1250 | 1251 | return 0; |
---|
1251 | 1252 | } |
---|
1252 | 1253 | |
---|
1253 | | -static int rk628_bt1120_get_ctrl(struct v4l2_ctrl *ctrl) |
---|
1254 | | -{ |
---|
1255 | | - int ret = -1; |
---|
1256 | | - struct rk628_bt1120 *bt1120 = container_of(ctrl->handler, struct rk628_bt1120, |
---|
1257 | | - hdl); |
---|
1258 | | - struct v4l2_subdev *sd = &(bt1120->sd); |
---|
1259 | | - |
---|
1260 | | - if (ctrl->id == V4L2_CID_DV_RX_POWER_PRESENT) { |
---|
1261 | | - ret = tx_5v_power_present(sd); |
---|
1262 | | - *ctrl->p_new.p_s32 = ret; |
---|
1263 | | - } |
---|
1264 | | - |
---|
1265 | | - return ret; |
---|
1266 | | -} |
---|
1267 | | - |
---|
1268 | 1254 | static int rk628_bt1120_enum_frame_sizes(struct v4l2_subdev *sd, |
---|
1269 | 1255 | struct v4l2_subdev_pad_config *cfg, |
---|
1270 | 1256 | struct v4l2_subdev_frame_size_enum *fse) |
---|
.. | .. |
---|
1542 | 1528 | case RKMODULE_GET_MODULE_INFO: |
---|
1543 | 1529 | rk628_bt1120_get_module_inf(bt1120, (struct rkmodule_inf *)arg); |
---|
1544 | 1530 | break; |
---|
| 1531 | + case RKMODULE_GET_HDMI_MODE: |
---|
| 1532 | + *(int *)arg = RKMODULE_HDMIIN_MODE; |
---|
| 1533 | + break; |
---|
1545 | 1534 | default: |
---|
1546 | 1535 | ret = -ENOIOCTLCMD; |
---|
1547 | 1536 | break; |
---|
.. | .. |
---|
1557 | 1546 | void __user *up = compat_ptr(arg); |
---|
1558 | 1547 | struct rkmodule_inf *inf; |
---|
1559 | 1548 | long ret; |
---|
| 1549 | + int *seq; |
---|
1560 | 1550 | |
---|
1561 | 1551 | switch (cmd) { |
---|
1562 | 1552 | case RKMODULE_GET_MODULE_INFO: |
---|
.. | .. |
---|
1574 | 1564 | } |
---|
1575 | 1565 | kfree(inf); |
---|
1576 | 1566 | break; |
---|
| 1567 | + case RKMODULE_GET_HDMI_MODE: |
---|
| 1568 | + seq = kzalloc(sizeof(*seq), GFP_KERNEL); |
---|
| 1569 | + if (!seq) { |
---|
| 1570 | + ret = -ENOMEM; |
---|
| 1571 | + return ret; |
---|
| 1572 | + } |
---|
1577 | 1573 | |
---|
| 1574 | + ret = rk628_bt1120_ioctl(sd, cmd, seq); |
---|
| 1575 | + if (!ret) { |
---|
| 1576 | + ret = copy_to_user(up, seq, sizeof(*seq)); |
---|
| 1577 | + if (ret) |
---|
| 1578 | + ret = -EFAULT; |
---|
| 1579 | + } |
---|
| 1580 | + kfree(seq); |
---|
| 1581 | + break; |
---|
1578 | 1582 | default: |
---|
1579 | 1583 | ret = -ENOIOCTLCMD; |
---|
1580 | 1584 | break; |
---|
.. | .. |
---|
1611 | 1615 | .open = bt1120_open, |
---|
1612 | 1616 | }; |
---|
1613 | 1617 | #endif |
---|
1614 | | - |
---|
1615 | | -static const struct v4l2_ctrl_ops rk628_bt1120_ctrl_ops = { |
---|
1616 | | - .g_volatile_ctrl = rk628_bt1120_get_ctrl, |
---|
1617 | | -}; |
---|
1618 | 1618 | |
---|
1619 | 1619 | static const struct v4l2_subdev_core_ops rk628_bt1120_core_ops = { |
---|
1620 | 1620 | .interrupt_service_routine = rk628_bt1120_isr, |
---|
.. | .. |
---|
1712 | 1712 | if (IS_ERR(bt1120->enable_gpio)) { |
---|
1713 | 1713 | ret = PTR_ERR(bt1120->enable_gpio); |
---|
1714 | 1714 | dev_err(dev, "failed to request enable GPIO: %d\n", ret); |
---|
1715 | | - return ret; |
---|
| 1715 | + goto clk_put; |
---|
1716 | 1716 | } |
---|
1717 | 1717 | |
---|
1718 | 1718 | bt1120->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); |
---|
1719 | 1719 | if (IS_ERR(bt1120->reset_gpio)) { |
---|
1720 | 1720 | ret = PTR_ERR(bt1120->reset_gpio); |
---|
1721 | 1721 | dev_err(dev, "failed to request reset GPIO: %d\n", ret); |
---|
1722 | | - return ret; |
---|
| 1722 | + goto clk_put; |
---|
1723 | 1723 | } |
---|
1724 | 1724 | |
---|
1725 | 1725 | bt1120->power_gpio = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_HIGH); |
---|
1726 | 1726 | if (IS_ERR(bt1120->power_gpio)) { |
---|
1727 | 1727 | dev_err(dev, "failed to get power gpio\n"); |
---|
1728 | 1728 | ret = PTR_ERR(bt1120->power_gpio); |
---|
1729 | | - return ret; |
---|
| 1729 | + goto clk_put; |
---|
1730 | 1730 | } |
---|
1731 | 1731 | |
---|
1732 | 1732 | bt1120->plugin_det_gpio = devm_gpiod_get_optional(dev, "plugin-det", |
---|
.. | .. |
---|
1734 | 1734 | if (IS_ERR(bt1120->plugin_det_gpio)) { |
---|
1735 | 1735 | dev_err(dev, "failed to get hdmirx det gpio\n"); |
---|
1736 | 1736 | ret = PTR_ERR(bt1120->plugin_det_gpio); |
---|
1737 | | - return ret; |
---|
| 1737 | + goto clk_put; |
---|
1738 | 1738 | } |
---|
1739 | 1739 | |
---|
1740 | 1740 | if (bt1120->enable_gpio) { |
---|
.. | .. |
---|
1768 | 1768 | ep = of_graph_get_next_endpoint(dev->of_node, NULL); |
---|
1769 | 1769 | if (!ep) { |
---|
1770 | 1770 | dev_err(dev, "missing endpoint node\n"); |
---|
1771 | | - return -EINVAL; |
---|
| 1771 | + ret = -EINVAL; |
---|
| 1772 | + goto clk_put; |
---|
1772 | 1773 | } |
---|
1773 | 1774 | |
---|
1774 | 1775 | ret = v4l2_fwnode_endpoint_alloc_parse(of_fwnode_handle(ep), &endpoint); |
---|
| 1776 | + of_node_put(ep); |
---|
1775 | 1777 | if (ret) { |
---|
1776 | 1778 | dev_err(dev, "failed to parse endpoint\n"); |
---|
1777 | | - of_node_put(ep); |
---|
1778 | | - return ret; |
---|
| 1779 | + goto clk_put; |
---|
1779 | 1780 | } |
---|
1780 | 1781 | |
---|
1781 | 1782 | bt1120->enable_hdcp = hdcp1x_enable; |
---|
.. | .. |
---|
1791 | 1792 | ret = 0; |
---|
1792 | 1793 | |
---|
1793 | 1794 | v4l2_fwnode_endpoint_free(&endpoint); |
---|
| 1795 | + |
---|
| 1796 | +clk_put: |
---|
| 1797 | + clk_disable_unprepare(bt1120->soc_24M); |
---|
1794 | 1798 | |
---|
1795 | 1799 | return ret; |
---|
1796 | 1800 | } |
---|
.. | .. |
---|
1872 | 1876 | V4L2_CID_PIXEL_RATE, 0, RK628_CSI_PIXEL_RATE_HIGH, 1, |
---|
1873 | 1877 | RK628_CSI_PIXEL_RATE_HIGH); |
---|
1874 | 1878 | bt1120->detect_tx_5v_ctrl = v4l2_ctrl_new_std(&bt1120->hdl, |
---|
1875 | | - &rk628_bt1120_ctrl_ops, V4L2_CID_DV_RX_POWER_PRESENT, |
---|
| 1879 | + NULL, V4L2_CID_DV_RX_POWER_PRESENT, |
---|
1876 | 1880 | 0, 1, 0, 0); |
---|
1877 | | - if (bt1120->detect_tx_5v_ctrl) |
---|
1878 | | - bt1120->detect_tx_5v_ctrl->flags |= V4L2_CTRL_FLAG_VOLATILE; |
---|
1879 | 1881 | |
---|
1880 | 1882 | /* custom controls */ |
---|
1881 | 1883 | bt1120->audio_sampling_rate_ctrl = v4l2_ctrl_new_custom(&bt1120->hdl, |
---|