Beispiel #1
0
static int bwpm_wifi_on( struct device *pdev , int on )
{
	bwpm_data_t *p_sts;

	if ( pdev == NULL ){
		disp_err( "device not found\n" );
		return -1;
	}

	p_sts = (bwpm_data_t *)dev_get_drvdata(pdev);
	if ( p_sts == NULL ){
		disp_err( "driver infomation not found\n" );
		return -1;
	}

	if ( p_sts->wifi == on ){
		disp_dbg( "%s: no need to change status (%d->%d)\n" , __func__, p_sts->wifi , on );
		return 0;
	}

	if ( on ){
		/* Turn ON RF/WLAN_IO-3.0V */
		if( ( p_sts->bluetooth <= 0 ) && ( p_sts->fm <= 0 ) ){
			gpio_set_value( BWPM_PORT_RF_LNA_EN, 1 );		/* WLAN_VDD_PA_LNA_EN */
    		disp_dbg( "%s: RF ON\n" , __func__);
			msleep(1);                                      /* over 200 micro seconds */
		}

		/* fix me : DCDC3 => ON at here*/
		tps65023_dcdc3_control(SH_PM_DCDC3_ON, SH_WLAN_USER);
		gpio_set_value( BWPM_PORT_WL_1P8V_EN, 1 );			/* WLAN_VREG_EN */
		msleep(5);

		gpio_set_value( BWPM_PORT_WL_RESET_N, 1 );			/* WLAN_RST */
	} else {

		gpio_set_value( BWPM_PORT_WL_RESET_N, 0 );			/* WLAN_RST */

		tps65023_dcdc3_control(SH_PM_DCDC3_OFF, SH_WLAN_USER);
		gpio_set_value( BWPM_PORT_WL_1P8V_EN, 0 );			/* WLAN_VREG_EN */

		if( ( p_sts->bluetooth <= 0 ) && ( p_sts->fm <= 0 ) ){
			msleep(1);                                      /* over 200 micro seconds */
			gpio_set_value( BWPM_PORT_RF_LNA_EN, 0 );		/* WLAN_VDD_PA_LNA_EN */
    		disp_dbg( "%s: RF OFF\n" , __func__);
		}
	}

	if ( p_sts->wifi < 0 ){
		disp_inf( "WiFi power on reset\n" );
	} else {
		disp_dbg( "%s: change status (%d->%d)\n" , __func__, p_sts->wifi , on );
	}
	p_sts->wifi = on;

	return 0;
}
Beispiel #2
0
void btpm_wifi_reg( int on )
{
	if( on ){                                           /* WLAN ON */
		if( bluetooth <= 0 ){
			gpio_set_value( BTPM_PORT_RF_LNA_EN, 1 );   /* BT_POW HIGH */
    		disp_dbg( "%s: RF ON\n" , __func__);
		}
	} else {                                            /* WLAN OFF */
		if( bluetooth <= 0 ){
			gpio_set_value( BTPM_PORT_RF_LNA_EN, 0 );   /* BT_POW LOW */
    		disp_dbg( "%s: RF OFF\n" , __func__);
		}
	}
	wifi = on;
}
Beispiel #3
0
static int bwpm_fm_on( struct device *pdev , int on )
{
	bwpm_data_t *p_sts;
    
	if ( pdev == NULL ){
		disp_err( "device not found\n" );
		return( -1 );
	}
	p_sts = (bwpm_data_t *)dev_get_drvdata(pdev);
	if ( p_sts == NULL ){
		disp_err( "driver infomation not found\n" );
		return -1;
	}
	if ( p_sts->fm == on ){
		disp_dbg( "%s: no need to change status (%d->%d)\n" , __func__, p_sts->fm , on );
		return 0;
	}

	if ( on ){
#if 0   /* 2010/08/20 GPIO 6mA Support*/
		/* Turn ON RF/WLAN_IO-3.0V */
		if( ( p_sts->wifi <= 0 ) && ( p_sts->bluetooth <= 0 ) ){
			gpio_set_value( BWPM_PORT_RF_LNA_EN, 1 );		    /* WLAN_VDD_PA_LNA_EN */
    		disp_dbg( "%s: RF ON\n" , __func__);
			/* BC7 is always turned on */
		}
#endif
		if( p_sts->bluetooth <= 0 ){
        	pmic_lp_mode_control( OFF_CMD, BWPM_LP_BT_PMIC_ID );  /* Normal power mode */
    		disp_dbg( "%s: Normal-Power-mode\n" , __func__);
		}
	} else {
        if( p_sts->bluetooth <= 0 ){
			pmic_lp_mode_control( ON_CMD, BWPM_LP_BT_PMIC_ID ); /* Low power mode */
      	    disp_dbg( "%s: Low-Power-mode\n" , __func__);
        }
#if 0   /* 2010/08/20 GPIO 6mA Support*/
		if( ( p_sts->wifi <= 0 ) && ( p_sts->bluetooth <= 0 ) ){
			/* BC7 is always turned on */
			gpio_set_value( BWPM_PORT_RF_LNA_EN, 0 );		    /* WLAN_VDD_PA_LNA_EN */
    		disp_dbg( "%s: RF OFF\n" , __func__);
		}
#endif
	}

	if ( p_sts->fm < 0 ){
		disp_inf( "fm power on reset\n" );
	} else {
		disp_dbg( "%s: change status (%d->%d)\n" , __func__, p_sts->fm , on );
	}
    p_sts->fm = on;

    return( 0 );
}
Beispiel #4
0
static int btpm_bluetooth_on( struct device *pdev , int on )
{
	btpm_data_t *p_sts;
    struct timespec tu;
#ifdef BTPM_BCM_4330
	int ret;
#endif

	if ( pdev == NULL ){
		disp_err( "device not found\n" );
		return -1;
	}

	p_sts = (btpm_data_t *)dev_get_drvdata(pdev);
	if ( p_sts == NULL ){
		disp_err( "driver infomation not found\n" );
		return -1;
	}

	if ( p_sts->bluetooth == on ){
		disp_dbg( "%s: no need to change status (%d->%d)\n" , __func__, p_sts->bluetooth , on );
		return 0;
	}

	if ( on ){
#ifdef BTPM_BCM_4330
		/* BT WAKE Configuration */
		ret = gpio_tlmm_config(GPIO_CFG( BTPM_WAKE_OUT, 0, GPIO_CFG_OUTPUT, GPIO_CFG_NO_PULL,   GPIO_CFG_6MA), GPIO_CFG_ENABLE);
		if (ret) {
			disp_err( "uart gpio_tlmm_config(BTPM_WAKE_OUT) : %d\n", ret);
			return -EIO;
		}
		ret = gpio_tlmm_config(GPIO_CFG( BTPM_WAKE_IN,  0, GPIO_CFG_INPUT,  GPIO_CFG_PULL_UP,   GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		if (ret) {
			disp_err( "uart gpio_tlmm_config(BTPM_WAKE_IN ) : %d\n", ret);
			return -EIO;
		}
#endif
		/* Turn ON RF/WLAN_IO-3.0V */
		gpio_set_value( BTPM_PORT_BT_RESET_N, 0 );              /* BTRST_N LOW */
		if( wifi <= 0 ){
			gpio_set_value( BTPM_PORT_RF_LNA_EN, 1 );		    /* BT_POW HIGH */
    		disp_dbg( "%s: RF ON\n" , __func__);
			/* BC7 is always turned on */
		}
        tu.tv_sec = (time_t)0;
        tu.tv_nsec = 20000000;                                  /* over 20ms */
        hrtimer_nanosleep(&tu, NULL, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
		gpio_set_value( BTPM_PORT_BT_RESET_N, 1 );              /* BTRST_N HIGH */
        tu.tv_sec = (time_t)0;
        tu.tv_nsec = 200000000;                                  /* over 200ms */
        hrtimer_nanosleep(&tu, NULL, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
		gpio_set_value( BTPM_WAKE_OUT, 0 );                     /* BT_WAKEOUT_N LOW(WAKE) */
	} else {
		gpio_set_value( BTPM_WAKE_OUT, 1 );                     /* BT_WAKEOUT_N HIGH(SLEEP) */
		gpio_set_value( BTPM_PORT_BT_RESET_N, 0 );              /* BTRST_N LOW */
		if( wifi <= 0 ){
            tu.tv_sec = (time_t)0;
            tu.tv_nsec = 1000000;                               /* over 1ms */
            hrtimer_nanosleep(&tu, NULL, HRTIMER_MODE_REL, CLOCK_MONOTONIC);
			/* BC7 is always turned on */
			gpio_set_value( BTPM_PORT_RF_LNA_EN, 0 );		    /* BT_POW LOW */
    		disp_dbg( "%s: RF OFF\n" , __func__);
		}
#ifdef BTPM_BCM_4330
		/* BT WAKE Configuration */
		ret = gpio_tlmm_config(GPIO_CFG( BTPM_WAKE_OUT, 0, GPIO_CFG_INPUT,  GPIO_CFG_PULL_DOWN, GPIO_CFG_6MA), GPIO_CFG_ENABLE);
		if (ret) {
			disp_err( "gpio_tlmm_config(BTPM_WAKE_OUT) : %d\n", ret);
			return -EIO;
		}
		ret = gpio_tlmm_config(GPIO_CFG( BTPM_WAKE_IN,  0, GPIO_CFG_INPUT,  GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
		if (ret) {
			disp_err( "gpio_tlmm_config(BTPM_WAKE_IN) : %d\n", ret);
			return -EIO;
		}
#endif
	}

	if ( p_sts->bluetooth < 0 ){
		disp_inf( "Bluetooth power on reset\n" );
	} else {
		disp_dbg( "%s: change status (%d->%d)\n" , __func__, p_sts->bluetooth , on );
	}
	p_sts->bluetooth = on;
	bluetooth = on;

	return 0;
}
Beispiel #5
0
static int bwpm_wifi_on( struct device *pdev , int on )
{
	bwpm_data_t *p_sts;
	int ret;

	if ( pdev == NULL ){
		disp_err( "device not found\n" );
		return -1;
	}

	p_sts = (bwpm_data_t *)dev_get_drvdata(pdev);
	if ( p_sts == NULL ){
		disp_err( "driver infomation not found\n" );
		return -1;
	}

	if ( p_sts->wifi == on ){
		disp_dbg( "%s: no need to change status (%d->%d)\n" , __func__, p_sts->wifi , on );
		return 0;
	}

	if ( on ){
		/* Turn ON RF/WLAN_IO-3.0V */
		if( p_sts->bluetooth <= 0 ){
			gpio_set_value( BWPM_PORT_RF_LNA_EN, 1 );		/* WLAN_VDD_PA_LNA_EN */
    		disp_dbg( "%s: RF ON\n" , __func__);
			msleep(1);                                      /* over 200 micro seconds */
		}

		/* PM8058_VREG_L19 => ON at here*/
		ret = vreg_enable( p_sts->vreg_wl );                /* Turn ON WL-1.8V */

//		gpio_set_value( BWPM_PORT_WL_1P8V_EN, 1 );			/* WLAN_VREG_EN */
		msleep(5);

		gpio_set_value( BWPM_PORT_WL_RESET_N, 1 );			/* WLAN_RST */
	} else {

		gpio_set_value( BWPM_PORT_WL_RESET_N, 0 );			/* WLAN_RST */

/* [WLAN][SHARP] 2010.12.27 mod Start */
#if 1 
		msleep(5);                                          /* over 1.5ms */
#endif
/* [WLAN][SHARP] 2010.12.27 mod End */

		/* PM8058_VREG_L19 => OFF at here */
		ret = vreg_disable( p_sts->vreg_wl );                /* Turn OFF WL-1.8V */

//		gpio_set_value( BWPM_PORT_WL_1P8V_EN, 0 );			/* WLAN_VREG_EN */

		if( p_sts->bluetooth <= 0 ){
			msleep(1);                                      /* over 200 micro seconds */
			gpio_set_value( BWPM_PORT_RF_LNA_EN, 0 );		/* WLAN_VDD_PA_LNA_EN */
    		disp_dbg( "%s: RF OFF\n" , __func__);
		}
	}

	if ( p_sts->wifi < 0 ){
		disp_inf( "WiFi power on reset\n" );
	} else {
		disp_dbg( "%s: change status (%d->%d)\n" , __func__, p_sts->wifi , on );
	}
	p_sts->wifi = on;

	return 0;
}