//enable/disable master clock int vfe_set_mclk(struct v4l2_subdev *sd, enum on_off on_off) { #ifdef VFE_CLK struct vfe_dev *dev=(struct vfe_dev *)dev_get_drvdata(sd->v4l2_dev->dev); switch(on_off) { case ON: vfe_print("mclk on\n"); if(dev->clock.vfe_master_clk) { if(os_clk_prepare_enable(dev->clock.vfe_master_clk)) { vfe_err("vip%d master clock enable error\n",dev->vip_sel); return -1; } } else { vfe_err("vip%d master clock is null\n",dev->vip_sel); return -1; } break; case OFF: vfe_print("mclk off\n"); if(dev->clock.vfe_master_clk) { os_clk_disable_unprepare(dev->clock.vfe_master_clk); } else { vfe_err("vip%d master clock is null\n",dev->vip_sel); return -1; } break; default: return -1; } #endif return 0; }
//enable/disable master clock int vfe_set_mclk(struct v4l2_subdev *sd, enum on_off on_off) { #ifdef VFE_CLK struct vfe_gpio_cfg gpio_list; struct vfe_dev *dev=(struct vfe_dev *)dev_get_drvdata(sd->v4l2_dev->dev); switch(on_off) { case ON: vfe_print("mclk on\n"); os_gpio_set(&dev->gpio->mclk, 1); //set mclk PIN to MCLKt. usleep_range(10000,12000); if(dev->clock.vfe_master_clk) { if(os_clk_prepare_enable(dev->clock.vfe_master_clk)) { vfe_err("vip%d master clock enable error\n",dev->vip_sel); return -1; } } else { vfe_err("vip%d master clock is null\n",dev->vip_sel); return -1; } break; case OFF: vfe_print("mclk off\n"); if(dev->clock.vfe_master_clk) { os_clk_disable_unprepare(dev->clock.vfe_master_clk); } else { vfe_err("vip%d master clock is null\n",dev->vip_sel); return -1; } usleep_range(10000,12000); memcpy(&gpio_list, &dev->gpio->mclk, sizeof(struct vfe_gpio_cfg)); gpio_list.mul_sel = GPIO_OUTPUT; //set mclk PIN to output. os_gpio_set(&gpio_list, 1); vfe_gpio_write(sd, MCLK_PIN, 0); break; default: return -1; } #endif return 0; }