.. | .. |
---|
7 | 7 | #include <linux/pm_runtime.h> |
---|
8 | 8 | #include <media/v4l2-ctrls.h> |
---|
9 | 9 | #include <media/v4l2-device.h> |
---|
| 10 | +#include <media/v4l2-fwnode.h> |
---|
10 | 11 | |
---|
11 | 12 | #define OV13858_REG_VALUE_08BIT 1 |
---|
12 | 13 | #define OV13858_REG_VALUE_16BIT 2 |
---|
.. | .. |
---|
1224 | 1225 | ov13858->exposure->minimum, |
---|
1225 | 1226 | max, ov13858->exposure->step, max); |
---|
1226 | 1227 | break; |
---|
1227 | | - }; |
---|
| 1228 | + } |
---|
1228 | 1229 | |
---|
1229 | 1230 | /* |
---|
1230 | 1231 | * Applying V4L2 control value only happens |
---|
.. | .. |
---|
1262 | 1263 | "ctrl(id:0x%x,val:0x%x) is not handled\n", |
---|
1263 | 1264 | ctrl->id, ctrl->val); |
---|
1264 | 1265 | break; |
---|
1265 | | - }; |
---|
| 1266 | + } |
---|
1266 | 1267 | |
---|
1267 | 1268 | pm_runtime_put(&client->dev); |
---|
1268 | 1269 | |
---|
.. | .. |
---|
1589 | 1590 | static int ov13858_init_controls(struct ov13858 *ov13858) |
---|
1590 | 1591 | { |
---|
1591 | 1592 | struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd); |
---|
| 1593 | + struct v4l2_fwnode_device_properties props; |
---|
1592 | 1594 | struct v4l2_ctrl_handler *ctrl_hdlr; |
---|
1593 | 1595 | s64 exposure_max; |
---|
1594 | 1596 | s64 vblank_def; |
---|
.. | .. |
---|
1600 | 1602 | int ret; |
---|
1601 | 1603 | |
---|
1602 | 1604 | ctrl_hdlr = &ov13858->ctrl_handler; |
---|
1603 | | - ret = v4l2_ctrl_handler_init(ctrl_hdlr, 8); |
---|
| 1605 | + ret = v4l2_ctrl_handler_init(ctrl_hdlr, 10); |
---|
1604 | 1606 | if (ret) |
---|
1605 | 1607 | return ret; |
---|
1606 | 1608 | |
---|
.. | .. |
---|
1665 | 1667 | __func__, ret); |
---|
1666 | 1668 | goto error; |
---|
1667 | 1669 | } |
---|
| 1670 | + |
---|
| 1671 | + ret = v4l2_fwnode_device_parse(&client->dev, &props); |
---|
| 1672 | + if (ret) |
---|
| 1673 | + goto error; |
---|
| 1674 | + |
---|
| 1675 | + ret = v4l2_ctrl_new_fwnode_properties(ctrl_hdlr, &ov13858_ctrl_ops, |
---|
| 1676 | + &props); |
---|
| 1677 | + if (ret) |
---|
| 1678 | + goto error; |
---|
1668 | 1679 | |
---|
1669 | 1680 | ov13858->sd.ctrl_handler = ctrl_hdlr; |
---|
1670 | 1681 | |
---|
.. | .. |
---|
1737 | 1748 | * Device is already turned on by i2c-core with ACPI domain PM. |
---|
1738 | 1749 | * Enable runtime PM and turn off the device. |
---|
1739 | 1750 | */ |
---|
1740 | | - pm_runtime_get_noresume(&client->dev); |
---|
1741 | 1751 | pm_runtime_set_active(&client->dev); |
---|
1742 | 1752 | pm_runtime_enable(&client->dev); |
---|
1743 | | - pm_runtime_put(&client->dev); |
---|
| 1753 | + pm_runtime_idle(&client->dev); |
---|
1744 | 1754 | |
---|
1745 | 1755 | return 0; |
---|
1746 | 1756 | |
---|
.. | .. |
---|
1763 | 1773 | media_entity_cleanup(&sd->entity); |
---|
1764 | 1774 | ov13858_free_controls(ov13858); |
---|
1765 | 1775 | |
---|
1766 | | - /* |
---|
1767 | | - * Disable runtime PM but keep the device turned on. |
---|
1768 | | - * i2c-core with ACPI domain PM will turn off the device. |
---|
1769 | | - */ |
---|
1770 | | - pm_runtime_get_sync(&client->dev); |
---|
1771 | 1776 | pm_runtime_disable(&client->dev); |
---|
1772 | | - pm_runtime_set_suspended(&client->dev); |
---|
1773 | | - pm_runtime_put_noidle(&client->dev); |
---|
1774 | 1777 | |
---|
1775 | 1778 | return 0; |
---|
1776 | 1779 | } |
---|