| .. | .. |
|---|
| 23 | 23 | #include <media/videobuf2-dma-sg.h> |
|---|
| 24 | 24 | #include <media/v4l2-fwnode.h> |
|---|
| 25 | 25 | #include <linux/iommu.h> |
|---|
| 26 | | -#include <dt-bindings/soc/rockchip-system-status.h> |
|---|
| 27 | 26 | #include <soc/rockchip/rockchip-system-status.h> |
|---|
| 28 | 27 | #include <linux/io.h> |
|---|
| 29 | 28 | #include <linux/mfd/syscon.h> |
|---|
| .. | .. |
|---|
| 699 | 698 | [CIF_REG_MIPI_EFFECT_CODE_ID1] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID1), |
|---|
| 700 | 699 | [CIF_REG_MIPI_EFFECT_CODE_ID2] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID2), |
|---|
| 701 | 700 | [CIF_REG_MIPI_EFFECT_CODE_ID3] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID3), |
|---|
| 701 | + [CIF_REG_MIPI_FRAME_SIZE_ID0] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID0), |
|---|
| 702 | + [CIF_REG_MIPI_FRAME_SIZE_ID1] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID1), |
|---|
| 703 | + [CIF_REG_MIPI_FRAME_SIZE_ID2] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID2), |
|---|
| 704 | + [CIF_REG_MIPI_FRAME_SIZE_ID3] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID3), |
|---|
| 702 | 705 | [CIF_REG_MIPI_ON_PAD] = CIF_REG(CSI_MIPI0_ON_PAD), |
|---|
| 703 | 706 | |
|---|
| 704 | 707 | [CIF_REG_GLB_CTRL] = CIF_REG(GLB_CTRL), |
|---|
| .. | .. |
|---|
| 823 | 826 | [CIF_REG_MIPI_EFFECT_CODE_ID1] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID1), |
|---|
| 824 | 827 | [CIF_REG_MIPI_EFFECT_CODE_ID2] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID2), |
|---|
| 825 | 828 | [CIF_REG_MIPI_EFFECT_CODE_ID3] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID3), |
|---|
| 829 | + [CIF_REG_MIPI_FRAME_SIZE_ID0] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID0), |
|---|
| 830 | + [CIF_REG_MIPI_FRAME_SIZE_ID1] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID1), |
|---|
| 831 | + [CIF_REG_MIPI_FRAME_SIZE_ID2] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID2), |
|---|
| 832 | + [CIF_REG_MIPI_FRAME_SIZE_ID3] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID3), |
|---|
| 826 | 833 | [CIF_REG_MIPI_ON_PAD] = CIF_REG(CSI_MIPI0_ON_PAD), |
|---|
| 827 | 834 | [CIF_REG_LVDS_ID0_CTRL0] = CIF_REG(CIF_LVDS0_ID0_CTRL0), |
|---|
| 828 | 835 | [CIF_REG_LVDS_ID1_CTRL0] = CIF_REG(CIF_LVDS0_ID1_CTRL0), |
|---|
| .. | .. |
|---|
| 942 | 949 | [CIF_REG_MIPI_EFFECT_CODE_ID1] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID1), |
|---|
| 943 | 950 | [CIF_REG_MIPI_EFFECT_CODE_ID2] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID2), |
|---|
| 944 | 951 | [CIF_REG_MIPI_EFFECT_CODE_ID3] = CIF_REG(CSI_MIPI0_EFFECT_CODE_ID3), |
|---|
| 952 | + [CIF_REG_MIPI_FRAME_SIZE_ID0] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID0), |
|---|
| 953 | + [CIF_REG_MIPI_FRAME_SIZE_ID1] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID1), |
|---|
| 954 | + [CIF_REG_MIPI_FRAME_SIZE_ID2] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID2), |
|---|
| 955 | + [CIF_REG_MIPI_FRAME_SIZE_ID3] = CIF_REG(CSI_MIPI0_FRAME_SIZE_ID3), |
|---|
| 945 | 956 | [CIF_REG_MIPI_ON_PAD] = CIF_REG(CSI_MIPI0_ON_PAD), |
|---|
| 946 | 957 | |
|---|
| 947 | 958 | [CIF_REG_GLB_CTRL] = CIF_REG(GLB_CTRL), |
|---|
| .. | .. |
|---|
| 1538 | 1549 | return 0; |
|---|
| 1539 | 1550 | } |
|---|
| 1540 | 1551 | |
|---|
| 1552 | +static int __maybe_unused rkcif_sleep_suspend(struct device *dev) |
|---|
| 1553 | +{ |
|---|
| 1554 | + struct rkcif_hw *cif_hw = dev_get_drvdata(dev); |
|---|
| 1555 | + |
|---|
| 1556 | + if (atomic_read(&cif_hw->power_cnt) == 0) |
|---|
| 1557 | + return 0; |
|---|
| 1558 | + |
|---|
| 1559 | + rkcif_disable_sys_clk(cif_hw); |
|---|
| 1560 | + |
|---|
| 1561 | + return pinctrl_pm_select_sleep_state(dev); |
|---|
| 1562 | +} |
|---|
| 1563 | + |
|---|
| 1564 | +static int __maybe_unused rkcif_sleep_resume(struct device *dev) |
|---|
| 1565 | +{ |
|---|
| 1566 | + struct rkcif_hw *cif_hw = dev_get_drvdata(dev); |
|---|
| 1567 | + int ret; |
|---|
| 1568 | + |
|---|
| 1569 | + if (atomic_read(&cif_hw->power_cnt) == 0) |
|---|
| 1570 | + return 0; |
|---|
| 1571 | + |
|---|
| 1572 | + ret = pinctrl_pm_select_default_state(dev); |
|---|
| 1573 | + if (ret < 0) |
|---|
| 1574 | + return ret; |
|---|
| 1575 | + rkcif_enable_sys_clk(cif_hw); |
|---|
| 1576 | + rkcif_hw_soft_reset(cif_hw, true); |
|---|
| 1577 | + |
|---|
| 1578 | + return 0; |
|---|
| 1579 | +} |
|---|
| 1580 | + |
|---|
| 1541 | 1581 | static const struct dev_pm_ops rkcif_plat_pm_ops = { |
|---|
| 1582 | + SET_LATE_SYSTEM_SLEEP_PM_OPS(rkcif_sleep_suspend, |
|---|
| 1583 | + rkcif_sleep_resume) |
|---|
| 1542 | 1584 | SET_RUNTIME_PM_OPS(rkcif_runtime_suspend, rkcif_runtime_resume, NULL) |
|---|
| 1543 | 1585 | }; |
|---|
| 1544 | 1586 | |
|---|