Ejemplo n.º 1
0
static
ssize_t set_bluetooth_power(struct device *pdev, struct device_attribute *pattr, const char *buf, size_t count)
{
	if ( (buf[0]==0) || (buf[0]==1) ){
		bwpm_bluetooth_on( pdev, (int)buf[0] );
        return( count );
	}

	return( 0 );
}
Ejemplo n.º 2
0
static
ssize_t set_bluetooth_power(struct device *pdev, struct device_attribute *pattr, const char *buf, size_t count)
{
	if ( (buf[0]==0) || (buf[0]==1) ){
		bwpm_bluetooth_on( pdev, (int)buf[0] );
        return( count );
	}
#if 1 /* Customize for Bluetooth */
    else if ( (buf[0]==9) ){
		bwpm_bluetooth_reset( pdev, (int)buf[0] );
        return( count );
    }
#endif /* Customize for Bluetooth */

	return( 0 );
}
Ejemplo n.º 3
0
/*::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

	Driver Description

 *:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::*/
static int bwpm_driver_probe( struct platform_device *pdev )
{
	int pin;
	int ret;
	struct vreg *vreg_bt;
	struct vreg *vreg_wl;
	bwpm_data_t *p_priv;

    int ini;

	/* Port Configuration */
	for (pin = 0; pin < ARRAY_SIZE(bwpm_gpio_config); pin++) {
		ret = gpio_tlmm_config( bwpm_gpio_config[pin], GPIO_CFG_ENABLE );
		if (ret) {
			disp_err( "gpio_tlmm_config(%d)<-%#x : %d\n", pin,bwpm_gpio_config[pin], ret);
			return -EIO;
		}
	}

	/* Regurator Configuration for BT */
	vreg_bt = vreg_get(NULL, "wlan");
	if (IS_ERR(vreg_bt)) {
		disp_err( "vreg get failed (%ld)\n", PTR_ERR(vreg_bt) );
		return PTR_ERR(vreg_bt);
	}
	ret = vreg_set_level( vreg_bt, BWPM_VREG_L13_LEVEL );
	if ( ret ) {
		disp_err( "vreg set level failed (%d)\n", ret) ;
		return -EIO;
	}

	/* Regurator Configration for wlan */
	vreg_wl = vreg_get(NULL, "wlan2");
	if (IS_ERR(vreg_wl)) {
		disp_err( "vreg get for wlan failed (%ld)\n", PTR_ERR(vreg_wl) );
		return PTR_ERR(vreg_wl);
	}
	ret = vreg_set_level( vreg_wl, BWPM_VREG_L19_LEVEL );
	if ( ret ) {
		disp_err( "vreg set level for wlan failed (%d)\n", ret) ;
		return -EIO;
	}

	/* Initialize private data */
	p_priv = kmalloc( sizeof(*p_priv) , GFP_KERNEL );
	if ( p_priv == NULL ){
		disp_err( "memory allocation for private data failed\n" );
		return -ENOMEM;
	}
	p_priv->vreg_bt = vreg_bt;
	p_priv->vreg_wl = vreg_wl;
	platform_set_drvdata( pdev , p_priv );

	/* power on reset */
    bwpm_reset( &(pdev->dev) );

	/* power on */
	ini = BWPM_INI_FM;
	if ( ini ){
		bwpm_fm_on( &(pdev->dev) , 1 );
	}
	ini = BWPM_INI_BT;
	if ( ini ){
		bwpm_bluetooth_on( &(pdev->dev) , 1 );
	}
	ini = BWPM_INI_WL;
	if ( ini ){
		bwpm_wifi_on( &(pdev->dev) , 1 );
	}

	/* create sysfs interface */
	ret = sysfs_create_group( &(pdev->dev.kobj), &bwpm_device_attributes_gourp);
	if ( ret ){
		disp_err( "Sysfs attribute export failed with error %d.\n" , ret );
	}

	return ret;
}