/****************************************************************************** * function: tuner_drv_ctl_power * brief : power control of a driver * date : 2011.08.26 * author : M.Takahashi(*) * * return : 0 normal exit * : -1 error exit * input : data setting data * output : none ******************************************************************************/ int tuner_drv_ctl_power( int data ) { /* power on */ if( data == TUNER_DRV_CTL_POWON ) { printk("tuner_drv_ctl_power poweron\n"); /* poweron gpio config setting */ tuner_drv_gpio_config_poweron(); /* TMM_PWR_EN high */ gpio_set_value(isdbtmm_pdata->gpio_en, 1); /* 15ms sleep */ usleep_range(15000, 15000); /* TMM_RST high */ gpio_set_value(isdbtmm_pdata->gpio_rst, 1); /* 2ms sleep */ usleep_range(2000, 2000); } /* power off */ else { printk("tuner_drv_ctl_power poweroff\n"); /* poweroff gpio config setting */ tuner_drv_gpio_config_poweroff(); gpio_set_value(isdbtmm_pdata->gpio_i2c_sda, 0); printk("ISDBTMM POWER OFF GPIO_I2C_SDA = %d\n",gpio_get_value_cansleep(isdbtmm_pdata->gpio_i2c_sda)); gpio_set_value(isdbtmm_pdata->gpio_spi_di, 0); gpio_set_value(isdbtmm_pdata->gpio_spi_do, 0); gpio_set_value(isdbtmm_pdata->gpio_spi_clk, 0); gpio_set_value(isdbtmm_pdata->gpio_spi_cs, 0); /* 1ms sleep */ usleep_range(1000, 1000); /* TMM_RST low */ gpio_set_value(isdbtmm_pdata->gpio_rst, 0); /* 2ms sleep */ usleep_range(2000, 2000); /* TMM_PWR_EN low */ gpio_set_value(isdbtmm_pdata->gpio_en, 0); } return 0; }
/****************************************************************************** * function: tuner_drv_ctl_power * brief : power control of a driver * date : 2011.08.26 * author : M.Takahashi(*) * * return : 0 normal exit * : -1 error exit * input : data setting data * output : none ******************************************************************************/ int tuner_drv_ctl_power( int data ) { /* power on */ if( data == TUNER_DRV_CTL_POWON ) { DEBUG_PRINT("tuner_drv_ctl_power poweron\n"); /* poweron gpio config setting */ tuner_drv_gpio_config_poweron(); /* TMM_PWR_EN high */ gpio_set_value(GPIO_TMM_PWR_EN, GPIO_LEVEL_HIGH); /* 15ms sleep */ usleep_range(15000, 15000); /* TMM_RST high */ gpio_set_value(GPIO_TMM_RST, GPIO_LEVEL_HIGH); /* 2ms sleep */ usleep_range(2000, 2000); } /* power off */ else { DEBUG_PRINT("tuner_drv_ctl_power poweroff\n"); /* poweroff gpio config setting */ tuner_drv_gpio_config_poweroff(); /* 1ms sleep */ usleep_range(1000, 1000); /* TMM_RST low */ gpio_set_value(GPIO_TMM_RST, GPIO_LEVEL_LOW); /* 2ms sleep */ usleep_range(2000, 2000); /* TMM_PWR_EN low */ gpio_set_value(GPIO_TMM_PWR_EN, GPIO_LEVEL_LOW); } return 0; }
/****************************************************************************** * function: tuner_drv_ctl_power * brief : power control of a driver * date : 2011.08.26 * author : M.Takahashi(*) * * return : 0 normal exit * : -1 error exit * input : data setting data * output : none ******************************************************************************/ int tuner_drv_ctl_power( int data ) { int ret = 0; int result = 0; static struct regulator *tmm_vreg_l15; static struct regulator *tmm_vreg_l27; /* Get Power ON 1.8V Reulator */ if ( NULL == tmm_vreg_l15 ) { tmm_vreg_l15 = regulator_get ( NULL, "8921_l15" ); if ( IS_ERR ( tmm_vreg_l15 )) { ERROR_PRINT("could not get 8921_l15, rc = %ld", PTR_ERR(tmm_vreg_l15)); tmm_vreg_l15 = NULL; return ret; } ret = regulator_set_voltage(tmm_vreg_l15, 1800000, 1800000 ); if ( ret ) { ERROR_PRINT("set voltage l15 failed, rc=%d", ret); tmm_vreg_l15 = NULL; return ret; } } /* Get Power ON 1.1V Reulator */ if ( NULL == tmm_vreg_l27 ) { tmm_vreg_l27 = regulator_get(NULL, "8921_l27"); if ( IS_ERR ( tmm_vreg_l27 )) { ERROR_PRINT("could not get 8921_l27, rc = %ld", PTR_ERR(tmm_vreg_l27)); tmm_vreg_l27 = NULL; return ret; } ret = regulator_set_voltage(tmm_vreg_l27, 1100000, 1100000 ); if ( ret ) { ERROR_PRINT("set voltage l27 failed, rc=%d", ret); tmm_vreg_l27 = NULL; return ret; } } /* power on */ if( data == TUNER_DRV_CTL_POWON ) { DEBUG_PRINT("tuner_drv_ctl_power poweron"); /* poweron gpio config setting */ tuner_drv_gpio_config_poweron(); /* P.ON = 1.8V */ if ( NULL != tmm_vreg_l15 ) { ret = regulator_enable(tmm_vreg_l15); if ( ret ) { ERROR_PRINT("enable l15 failed, rc=%d", ret); return ret; } } /* P.ON = 1.1V */ if ( NULL != tmm_vreg_l27 ) { ret = regulator_enable(tmm_vreg_l27); if ( ret ) { ERROR_PRINT("enable l27 failed, rc=%d", ret); return ret; } } /* TMM_PWR_EN high */ ret = ice_gpiox_set(FPGA_GPIO_TMM_PWR_EN, 1); if (ret < 0) { ERROR_PRINT("FPGA_GPIO_TMM_PWR_EN high set error"); return ret; } /* 15ms sleep */ usleep_range(15000, 15000); /* TMM_RST high */ ret = ice_gpiox_set(FPGA_GPIO_TMM_RST, 1); if (ret < 0) { ERROR_PRINT("FPGA_GPIO_TMM_RST high set error"); return ret; } /* 2ms sleep */ usleep_range(2000, 2000); } /* power off */ else { DEBUG_PRINT("tuner_drv_ctl_power poweroff"); /* poweroff gpio config setting */ tuner_drv_gpio_config_poweroff(); /* 1ms sleep */ usleep_range(1000, 1000); /* TMM_RST low */ ret = ice_gpiox_set(FPGA_GPIO_TMM_RST, 0); if (ret < 0) { ERROR_PRINT("FPGA_GPIO_TMM_RST low set error"); result = ret; } /* 2ms sleep */ usleep_range(2000, 2000); /* TMM_PWR_EN low */ ret = ice_gpiox_set(FPGA_GPIO_TMM_PWR_EN, 0); if (ret < 0) { ERROR_PRINT("FPGA_GPIO_TMM_PWR_EN low set error"); result = ret; } /* P.OFF = 1.8V */ if (regulator_is_enabled(tmm_vreg_l15)) { ret = regulator_disable(tmm_vreg_l15); if ( ret ) { ERROR_PRINT("disable l15 failed, rc=%d", ret); result = -1; } } /* P.OFF = 1.1V */ if (regulator_is_enabled(tmm_vreg_l27)) { ret = regulator_disable(tmm_vreg_l27); if ( ret ) { ERROR_PRINT("disable l27 failed, rc=%d", ret); result = -1; } } } return ( result ); }