int s3c_csis_clk_off(struct platform_device *pdev, struct clk **clk) { struct clk *sclk_csis = NULL; struct s3c_platform_csis *pdata; int ret; pdata = to_csis_plat(&pdev->dev); /* sclk_csis */ sclk_csis = clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(sclk_csis)) { dev_err(&pdev->dev, "failed to get csis clock source\n"); return -EINVAL; } /* clock disable for csis */ clk_disable(sclk_csis); /* power domain disable for mipi-csis */ ret = s5pv210_pd_disable("csis_pd"); if (ret < 0) { dev_err(&pdev->dev, "failed to enable csis power domain\n"); return -EINVAL; } return 0; }
/* sleep */ int s3c_csis_suspend(struct platform_device *pdev, pm_message_t state) { struct s3c_platform_csis *pdata = NULL; pdata = to_csis_plat(&pdev->dev); return 0; }
static int s3c_csis_probe(struct platform_device *pdev) { struct s3c_platform_csis *pdata; struct resource *res; int ret = 0; ret = s3c_csis_set_info(pdev); s3c_csis[pdev->id]->dev = &pdev->dev; pdata = to_csis_plat(&pdev->dev); if (pdata->cfg_gpio) pdata->cfg_gpio(); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { err("failed to get io memory region\n"); ret = -ENOENT; goto err_info; } s3c_csis[pdev->id]->regs_res = request_mem_region(res->start, resource_size(res), pdev->name); if (!s3c_csis[pdev->id]->regs_res) { err("failed to request io memory region\n"); ret = -ENOENT; goto err_info; } /* ioremap for register block */ s3c_csis[pdev->id]->regs = ioremap(res->start, resource_size(res)); if (!s3c_csis[pdev->id]->regs) { err("failed to remap io region\n"); ret = -ENXIO; goto err_req_region; } /* irq */ s3c_csis[pdev->id]->irq = platform_get_irq(pdev, 0); ret = request_irq(s3c_csis[pdev->id]->irq, s3c_csis_irq, IRQF_DISABLED, s3c_csis[pdev->id]->name, pdev); if (ret) { err("request_irq failed\n"); goto err_regs_unmap; } info("Samsung MIPI-CSIS%d driver probed successfully\n", pdev->id); return 0; err_regs_unmap: iounmap(s3c_csis[pdev->id]->regs); err_req_region: release_resource(s3c_csis[pdev->id]->regs_res); kfree(s3c_csis[pdev->id]->regs_res); err_info: kfree(s3c_csis[pdev->id]); return ret; }
/* wakeup */ int s3c_csis_resume(struct platform_device *pdev) { struct s3c_platform_csis *pdata = NULL; pdata = to_csis_plat(&pdev->dev); return 0; }
void s3c_csis_start(int lanes, int settle, int align, int width, int height, int pixel_format) { struct platform_device *pdev = to_platform_device(s3c_csis->dev); struct s3c_platform_csis *pdata; /* clock & power on */ s3c_csis_clk_on(pdev); pdata = to_csis_plat(s3c_csis->dev); if (pdata->cfg_phy_global) pdata->cfg_phy_global(pdev, 1); s3c_csis_reset(); s3c_csis_set_nr_lanes(lanes); #ifdef CONFIG_MIPI_CSI_ADV_FEATURE /* FIXME: how configure the followings with FIMC dynamically? */ s3c_csis_set_hs_settle(settle); /* s5k6aa */ s3c_csis_set_data_align(align); s3c_csis_set_wclk(0); if (pixel_format == V4L2_PIX_FMT_JPEG) s3c_csis_set_format(MIPI_USER_DEF_PACKET_1); else s3c_csis_set_format(MIPI_CSI_YCBCR422_8BIT); s3c_csis_set_resol(width, height); s3c_csis_update_shadow(); #endif s3c_csis_enable_interrupt(); s3c_csis_system_on(); s3c_csis_phy_on(); info("Samsung MIPI-CSI2 operation started\n"); }
void s3c_csis_stop(struct platform_device *pdev) { struct s3c_platform_csis *plat; s3c_csis_disable_interrupt(); s3c_csis_system_off(); s3c_csis_phy_off(); if(pdev) plat = to_csis_plat(&pdev->dev); else plat = to_csis_plat(s3c_csis->dev); if (plat->cfg_phy_global) plat->cfg_phy_global(pdev, 0); s3c_csis_clk_off(to_platform_device(s3c_csis->dev)); info("Samsung MIPI-CSI2 operation stoped\n"); }
static int s3c_csis_clk_on(struct platform_device *pdev) { struct s3c_platform_csis *pdata; struct clk *parent, *mout_csis; pdata = to_csis_plat(&pdev->dev); /* mout_mpll */ parent = clk_get(&pdev->dev, pdata->srclk_name); if (IS_ERR(parent)) { err("failed to get parent clock for csis\n"); return -EINVAL; } /* mout_csis */ mout_csis = clk_get(&pdev->dev, "mout_csis"); /* sclk_csis */ s3c_csis->clock = clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(s3c_csis->clock)) { err("failed to get csis clock source\n"); return -EINVAL; } clk_set_parent(mout_csis, parent); clk_set_parent(s3c_csis->clock, mout_csis); /* Turn on csis power domain regulator */ regulator_enable(s3c_csis->regulator); /* clock enable for csis */ clk_enable(s3c_csis->clock); return 0; }
int s3c_csis_clk_on(struct platform_device *pdev, struct clk **clk) { struct s3c_platform_csis *pdata; struct clk *sclk_csis = NULL; struct clk *mout_mpll = NULL; pdata = to_csis_plat(&pdev->dev); /* mout_mpll */ mout_mpll = clk_get(&pdev->dev, pdata->srclk_name); if (IS_ERR(mout_mpll)) { dev_err(&pdev->dev, "failed to get mout_mpll\n"); goto err_clk1; } /* sclk_csis */ sclk_csis = clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(sclk_csis)) { dev_err(&pdev->dev, "failed to get sclk_csis\n"); goto err_clk2; } if (clk_set_parent(sclk_csis, mout_mpll)) { dev_err(&pdev->dev, "Unable to set parent %s of clock %s.\n", mout_mpll->name, sclk_csis->name); goto err_clk3; } if (clk_set_rate(sclk_csis, pdata->clk_rate)) { dev_err(&pdev->dev, "%s rate change failed: %lu\n", sclk_csis->name, pdata->clk_rate); goto err_clk3; } /* csis */ *clk = clk_get(&pdev->dev, "csis"); if (IS_ERR(*clk)) { dev_err(&pdev->dev, "failed to get csis clock\n"); goto err_clk3; } /* clock enable for csis */ clk_enable(*clk); clk_enable(sclk_csis); return 0; err_clk3: clk_put(sclk_csis); err_clk2: clk_put(mout_mpll); err_clk1: return -EINVAL; }
static int s3c_csis_probe(struct platform_device *pdev) { struct s3c_platform_csis *pdata; struct resource *res; s3c_csis_set_info(); s3c_csis->dev = &pdev->dev; s3c_csis->clockon = 0; pdata = to_csis_plat(&pdev->dev); if (pdata->cfg_gpio) pdata->cfg_gpio(); /* Get csis power domain regulator */ s3c_csis->regulator = regulator_get(&pdev->dev, "pd"); if (IS_ERR(s3c_csis->regulator)) { err("%s: failed to get regulator %s\n", __func__, pdev->name); return PTR_ERR(s3c_csis->regulator); } /* clock & power on */ s3c_csis_clk_on(pdev); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { err("failed to get io memory region\n"); return -EINVAL; } res = request_mem_region(res->start, res->end - res->start + 1, pdev->name); if (!res) { err("failed to request io memory region\n"); return -EINVAL; } /* ioremap for register block */ s3c_csis->regs = ioremap(res->start, res->end - res->start + 1); if (!s3c_csis->regs) { err("failed to remap io region\n"); return -EINVAL; } /* irq */ s3c_csis->irq = platform_get_irq(pdev, 0); if (request_irq(s3c_csis->irq, s3c_csis_irq, IRQF_DISABLED, \ s3c_csis->name, s3c_csis)) err("request_irq failed\n"); pr_info("Samsung MIPI-CSI2 driver probed successfully\n"); s3c_csis_clk_off(pdev); return 0; }
static void s3c_csis_stop(struct platform_device *pdev) { struct s3c_platform_csis *plat; s3c_csis_disable_interrupt(); s3c_csis_system_off(); s3c_csis_phy_off(); plat = to_csis_plat(&pdev->dev); if (plat->cfg_phy_global) plat->cfg_phy_global(/*pdev,*/ 0); }
int s3c_csis_clk_on(struct platform_device *pdev, struct clk **clk) { struct clk *sclk_csis = NULL; struct clk *parent = NULL; struct clk *mout_csis = NULL; struct s3c_platform_csis *pdata; int ret; /* power domain enable for mipi-csis */ ret = s5pv210_pd_enable("csis_pd"); if (ret < 0) { dev_err(&pdev->dev, "failed to enable csis power domain\n"); return -EINVAL; } pdata = to_csis_plat(&pdev->dev); /* mout_mpll */ parent = clk_get(&pdev->dev, pdata->srclk_name); if (IS_ERR(parent)) { dev_err(&pdev->dev, "failed to get parent clock for csis\n"); goto err_clk1; } /* mout_csis */ mout_csis = clk_get(&pdev->dev, "mout_csis"); if (IS_ERR(mout_csis)) { dev_err(&pdev->dev, "failed to get mout_csis clock source\n"); goto err_clk2; } /* sclk_csis */ sclk_csis = clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(sclk_csis)) { dev_err(&pdev->dev, "failed to get csis clock source\n"); goto err_clk3; } clk_set_parent(mout_csis, parent); clk_set_parent(sclk_csis, mout_csis); clk_enable(sclk_csis); return 0; err_clk3: clk_put(mout_csis); err_clk2: clk_put(parent); err_clk1: return -EINVAL; }
void s3c_csis_start(int csis_id, int lanes, int settle, int align, int width, \ int height, int pixel_format) { struct platform_device *pdev = NULL; struct s3c_platform_csis *pdata = NULL; int i; printk(KERN_INFO "csis width = %d, height = %d\n", width, height); memset(&s3c_csis[csis_id]->bufs, 0, sizeof(s3c_csis[csis_id]->bufs)); /* clock & power on */ pdev = to_platform_device(s3c_csis[csis_id]->dev); pdata = to_csis_plat(&pdev->dev); if (pdata->clk_on) pdata->clk_on(to_platform_device(s3c_csis[csis_id]->dev), &s3c_csis[csis_id]->clock); if (pdata->cfg_phy_global) pdata->cfg_phy_global(1); s3c_csis_reset(pdev); s3c_csis_set_nr_lanes(pdev, lanes); #ifdef CONFIG_MIPI_CSI_ADV_FEATURE /* FIXME: how configure the followings with FIMC dynamically? */ s3c_csis_set_hs_settle(pdev, settle); /* s5k6aa */ s3c_csis_set_data_align(pdev, align); s3c_csis_set_wclk(pdev, 1); if (pixel_format == V4L2_PIX_FMT_JPEG || pixel_format == V4L2_PIX_FMT_INTERLEAVED) { printk(KERN_INFO "%s V4L2_PIX_FMT_JPEG or INTERLEAVED\n", __func__); s3c_csis_set_format(pdev, MIPI_USER_DEF_PACKET_1); } else if (pixel_format == V4L2_PIX_FMT_SGRBG10) s3c_csis_set_format(pdev, MIPI_CSI_RAW10); else s3c_csis_set_format(pdev, MIPI_CSI_YCBCR422_8BIT); s3c_csis_set_resol(pdev, width, height); s3c_csis_update_shadow(pdev); #endif s3c_csis_enable_interrupt(pdev); s3c_csis_system_on(pdev); s3c_csis_phy_on(pdev); err_print_cnt = 0; info("Samsung MIPI-CSIS%d operation started\n", pdev->id); }
void s3c_csis_change_resolution(int csis_id, int width, int height) { struct platform_device *pdev = NULL; struct s3c_platform_csis *pdata = NULL; printk("\n =======CRYSTALcsis %s %d\n",__func__,__LINE__); /* clock & power on */ pdev = to_platform_device(s3c_csis[csis_id]->dev); pdata = to_csis_plat(&pdev->dev); s3c_csis_set_resol(pdev, width, height); s3c_csis_update_shadow(pdev); info("Samsung MIPI-CSIS%d Change resolution:w(%d) h(%d)\n", pdev->id,width,height); return; }
int s3c_csis_clk_on(struct platform_device *pdev, struct clk **clk) { struct clk *sclk_csis = NULL; struct clk *parent = NULL; struct clk *mout_csis = NULL; struct s3c_platform_csis *pdata; pdata = to_csis_plat(&pdev->dev); /* mout_mpll */ parent = clk_get(&pdev->dev, pdata->srclk_name); if (IS_ERR(parent)) { dev_err(&pdev->dev, "failed to get parent clock(%s) for csis\n", pdata->srclk_name); goto err_clk1; } /* mout_csis */ mout_csis = clk_get(&pdev->dev, "mout_csis"); if (IS_ERR(mout_csis)) { dev_err(&pdev->dev, "failed to get mout_csis clock source\n"); goto err_clk2; } /* sclk_csis */ sclk_csis = clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(sclk_csis)) { dev_err(&pdev->dev, "failed to get csis(%s) clock source\n", pdata->clk_name); goto err_clk3; } clk_set_parent(mout_csis, parent); clk_set_parent(sclk_csis, mout_csis); clk_enable(sclk_csis); return 0; err_clk3: clk_put(mout_csis); err_clk2: clk_put(parent); err_clk1: return -EINVAL; }
///#endif void s3c_csis_start(int csis_id, int lanes, int settle, int align, int width, \ int height, int pixel_format) { struct platform_device *pdev = NULL; struct s3c_platform_csis *pdata = NULL; /* clock & power on */ pdev = to_platform_device(s3c_csis[csis_id]->dev); pdata = to_csis_plat(&pdev->dev); if (pdata->clk_on) pdata->clk_on(to_platform_device(s3c_csis[csis_id]->dev), &s3c_csis[csis_id]->clock); if (pdata->cfg_phy_global) pdata->cfg_phy_global(1); s3c_csis_reset(pdev); s3c_csis_set_nr_lanes(pdev, lanes); #ifdef CONFIG_MIPI_CSI_ADV_FEATURE /* FIXME: how configure the followings with FIMC dynamically? */ s3c_csis_set_hs_settle(pdev, settle); /* s5k6aa */ s3c_csis_set_data_align(pdev, align); s3c_csis_set_wclk(pdev, 1); if (pixel_format == V4L2_PIX_FMT_JPEG) s3c_csis_set_format(pdev, MIPI_USER_DEF_PACKET_1); else if (pixel_format == V4L2_PIX_FMT_SGRBG10) s3c_csis_set_format(pdev, MIPI_CSI_RAW10); else s3c_csis_set_format(pdev, MIPI_CSI_YCBCR422_8BIT); s3c_csis_set_resol(pdev, width, height); s3c_csis_update_shadow(pdev); #endif s3c_csis_enable_interrupt(pdev); s3c_csis_system_on(pdev); s3c_csis_phy_on(pdev); err_print_cnt = 0; ///#ifdef CONFIG_VIDEO_S5K4ECGX mipi_start = 1;//zxz 2012-3-21 temp for 5m sensor ///#endif info("++Samsung MIPI-CSIS%d operation started\n", pdev->id); }
int s3c_csis_clk_off(struct platform_device *pdev, struct clk **clk) { struct clk *sclk_csis = NULL; struct s3c_platform_csis *pdata; pdata = to_csis_plat(&pdev->dev); /* sclk_csis */ sclk_csis = clk_get(&pdev->dev, pdata->clk_name); if (IS_ERR(sclk_csis)) { dev_err(&pdev->dev, "failed to get csis clock(%s) source\n", pdata->srclk_name); return -EINVAL; } /* clock disable for csis */ clk_disable(sclk_csis); return 0; }
void s3c_csis_stop(int csis_id) { struct platform_device *pdev = NULL; struct s3c_platform_csis *pdata = NULL; pdev = to_platform_device(s3c_csis[csis_id]->dev); pdata = to_csis_plat(&pdev->dev); s3c_csis_disable_interrupt(pdev); s3c_csis_system_off(pdev); s3c_csis_phy_off(pdev); if (pdata->cfg_phy_global) pdata->cfg_phy_global(0); if (pdata->clk_off) { if (s3c_csis[csis_id]->clock != NULL) pdata->clk_off(pdev, &s3c_csis[csis_id]->clock); } }
static int s3c_csis_clk_off(struct platform_device *pdev) { struct s3c_platform_csis *plat; plat = to_csis_plat(&pdev->dev); /* sclk_csis */ s3c_csis->clock = clk_get(&pdev->dev, plat->clk_name); if (IS_ERR(s3c_csis->clock)) { err("failed to get csis clock source\n"); return -EINVAL; } /* clock disable for csis */ clk_disable(s3c_csis->clock); /* Turn off csis power domain regulator */ regulator_disable(s3c_csis->regulator); return 0; }
void s3c_csis_stop(void) { struct platform_device *pdev = NULL; struct s3c_platform_csis *pdata = NULL; pdev = to_platform_device(s3c_csis->dev); pdata = to_csis_plat(&pdev->dev); s3c_csis_disable_interrupt(); s3c_csis_system_off(); s3c_csis_phy_off(); if (pdata->cfg_phy_global) pdata->cfg_phy_global(0); if (pdata->clk_off) pdata->clk_off(pdev, &s3c_csis->clock); regulator_disable(s3c_csis->regulator); debug("Samsung MIPI-CSI2 operation end\n"); }
void s3c_csis_stop(int csis_id) { struct platform_device *pdev = NULL; struct s3c_platform_csis *pdata = NULL; pdev = to_platform_device(s3c_csis[csis_id]->dev); pdata = to_csis_plat(&pdev->dev); s3c_csis_disable_interrupt(pdev); s3c_csis_system_off(pdev); s3c_csis_phy_off(pdev); if (pdata->cfg_phy_global) pdata->cfg_phy_global(0); if (pdata->clk_off) { if (s3c_csis[csis_id]->clock != NULL) pdata->clk_off(pdev, &s3c_csis[csis_id]->clock); } ///#ifdef CONFIG_VIDEO_S5K4ECGX mipi_start = 0;//zxz 2012-3-21 temp for 5m sensor ///#endif info("++Samsung MIPI-CSIS operation stop\n"); }