Exemple #1
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 );
}
Exemple #2
0
/* Customize for Bluetooth Power OFF sequence */
static int bwpm_power_off( struct device *pdev )
{
	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;
	}

	pmic_lp_mode_control( ON_CMD, BWPM_LP_BT_PMIC_ID ); /* Low power mode */
	gpio_set_value( BWPM_PORT_RF_LNA_EN, 0 );           /* WLAN_VDD_PA_LNA_EN */

#ifdef SUPPORT_UARTSEL
	gpio_set_value( BWPM_PORT_BT_UARTSEL, 0 );
#endif

	gpio_set_value( BWPM_PORT_BT_RESET_N, 1 );          /* Bluetooth Reset */
	gpio_set_value( BWPM_PORT_BT_RESET_N, 0 );

	msleep(10);                                         /* wait for 10msec */

	vreg_disable( p_sts->vreg_bt );                     /* Turn OFF BT-3.3V */

	return 0;
}
Exemple #3
0
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

	Local

 *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
static int bwpm_reset( struct device *pdev )
{
	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;
	}

	gpio_set_value( BWPM_PORT_BT_RESET_N, 0 );
	/* BC7 is always turned on */
	ret = vreg_enable( p_sts->vreg_bt );                /* Turn ON BT-3.3V */
    msleep(10);                                         /* wait for 10msec */
	gpio_set_value( BWPM_PORT_BT_RESET_N, 1 );          /* SYSRST */
    /* WLAN OFF */
	gpio_set_value( BWPM_PORT_WL_RESET_N, 0 );			/* WLAN_RST */
//	gpio_set_value( BWPM_PORT_WL_1P8V_EN, 0 );			/* WLAN_VREG_EN */
	msleep(1);                                          /* over 200 micro seconds */
    /* RF OFF -Low power mode- */
	pmic_lp_mode_control( ON_CMD, BWPM_LP_BT_PMIC_ID );  /* Low power mode */
	gpio_set_value( BWPM_PORT_RF_LNA_EN, 0 );           /* WLAN_VDD_PA_LNA_EN */

#ifdef SUPPORT_UARTSEL
	gpio_set_value( BWPM_PORT_BT_UARTSEL, 1 );
#endif

    /* init status */
	p_sts->fm          = 0;
	p_sts->bluetooth   = 0;
	p_sts->wifi        = 0;

    /* [Sharp] ShDiag WiFi High Speed Support Start */
	p_sts->wifi_shdiag_stat     = 0;       /* WiFi Stat Flag  Init */
    /* [Sharp] ShDiag WiFi High Speed Support  End  */


	return 0;
}
Exemple #4
0
static int debug_lp_mode_control(char *buf, int size)
{
	enum switch_cmd	cmd;
	enum vreg_lp_id	id;
	int	cnt;


	cnt = sscanf(buf, "%u %u", &cmd, &id);
	if (cnt < 2) {
		printk(KERN_ERR "%s: sscanf failed cnt=%d", __func__, cnt);
		return -EINVAL;
	}

	if (pmic_lp_mode_control(cmd, id) < 0)
		return -EFAULT;

	return size;
}
Exemple #5
0
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

	Local

 *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
static int bwpm_reset( struct device *pdev )
{
	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;
	}

	gpio_set_value( BWPM_PORT_BT_RESET_N, 0 );
	/* BC7 is always turned on */
	ret = vreg_enable( p_sts->vreg_bt );                /* Turn ON BT-3.3V */
    msleep(10);                                         /* wait for 10msec */
	gpio_set_value( BWPM_PORT_BT_RESET_N, 1 );          /* SYSRST */
    /* WLAN OFF */
	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 */
	msleep(1);                                          /* over 200 micro seconds */
    /* RF OFF -Low power mode- */
	pmic_lp_mode_control( ON_CMD, PM_VREG_LP_GP6_ID );  /* Low power mode */
	gpio_set_value( BWPM_PORT_RF_LNA_EN, 0 );           /* WLAN_VDD_PA_LNA_EN */

//	gpio_set_value( BWPM_PORT_BT_UARTSEL, 1 );

    /* init status */
	p_sts->fm          = 0;
	p_sts->bluetooth   = 0;
	p_sts->wifi        = 0;

	return 0;
}