Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

int _ipu_csi_mclk_set ( uint32_t  pixel_clk,
uint32_t  csi 
)

_ipu_csi_mclk_set

Parameters:
pixel_clk desired pixel clock frequency in Hz
csi csi 0 or csi 1
Returns:
Returns 0 on success or negative error code on fail

Definition at line 143 of file ipu_capture.c.

Referenced by ipu_csi_set_test_generator().

{
      uint32_t temp;
      uint32_t div_ratio;

      div_ratio = (clk_get_rate(g_ipu_clk) / pixel_clk) - 1;

      if (div_ratio > 0xFF || div_ratio < 0) {
            dev_dbg(g_ipu_dev, "The value of pixel_clk extends normal range\n");
            return -EINVAL;
      }

      temp = __raw_readl(CSI_SENS_CONF(csi));
      temp &= ~CSI_SENS_CONF_DIVRATIO_MASK;
      __raw_writel(temp | (div_ratio << CSI_SENS_CONF_DIVRATIO_SHIFT),
                  CSI_SENS_CONF(csi));

      return 0;
}


Generated by  Doxygen 1.6.0   Back to index