コード例 #1
0
static int qpnp_vib_set(struct qpnp_vib *vib, int on)
{
	int rc;
	u8 val;

	if (on) {
		val = vib->reg_vtg_ctl;
		val &= ~QPNP_VIB_VTG_SET_MASK;
		val |= (vib->vtg_level & QPNP_VIB_VTG_SET_MASK);
		rc = qpnp_vib_write_u8(vib, &val, QPNP_VIB_VTG_CTL(vib->base));
		if (rc < 0)
			return rc;
		vib->reg_vtg_ctl = val;
		val = vib->reg_en_ctl;
		val |= QPNP_VIB_EN;
		rc = qpnp_vib_write_u8(vib, &val, QPNP_VIB_EN_CTL(vib->base));
#ifdef CONFIG_QPNP_SCVIBRATOR
		if (rc < 0) {
			return rc;
		} else {
#ifdef CONFIG_SHTERM
			shterm_k_set_info( SHTERM_INFO_VIB, 1 );
#endif /* CONFIG_SHTERM */
		}
#else  /* CONFIG_QPNP_SCVIBRATOR */
		if (rc < 0)
			return rc;
#endif /* CONFIG_QPNP_SCVIBRATOR */
		vib->reg_en_ctl = val;
	} else {
		val = vib->reg_en_ctl;
		val &= ~QPNP_VIB_EN;
		rc = qpnp_vib_write_u8(vib, &val, QPNP_VIB_EN_CTL(vib->base));
#ifdef CONFIG_QPNP_SCVIBRATOR
		if (rc < 0) {
			return rc;
		} else {
#ifdef CONFIG_SHTERM
			shterm_k_set_info( SHTERM_INFO_VIB, 0 );
#endif /* CONFIG_SHTERM */
		}
#else  /* CONFIG_QPNP_SCVIBRATOR */
		if (rc < 0)
			return rc;
#endif /* CONFIG_QPNP_SCVIBRATOR */
		vib->reg_en_ctl = val;
	}

	return rc;
}
コード例 #2
0
void shspamp_poweron()
{
/* [BatteryTemperatureLog] [start] */
    if (shspamp_shterm_flg == false) {
        shterm_k_set_info( SHTERM_INFO_SPEAKER, 1 );
        shspamp_shterm_flg = true;
    }
/* [BatteryTemperatureLog] [end] */

	gpio_set_value(SHSPAMP_PDN, 1);
	
	if(spamp_data){
		shspamp_i2c_write(spamp_data->client_p, 0x02, SHSPAMP_MUTEN_MUTE);   /* SLEEPN bit = 0 */
		shspamp_i2c_write(spamp_data->client_p, 0x03, 0x14);                 /* [PRGAIN] GAIN:+19db */
		shspamp_i2c_write(spamp_data->client_p, 0x04, 0x01);                 /* [MODE] MODE:Loud(ALC) */
		shspamp_i2c_write(spamp_data->client_p, 0x06, 0x09);                 /* [LOUD] HDRM:+1dB, Loud:LD1 */
		shspamp_i2c_write(spamp_data->client_p, 0x02, SHSPAMP_MUTEN_UNMUTE); /* SLEEPN bit = 1 */

		if(svSetMuten == SHSPAMP_MUTEN_MUTE)
		{
			shspamp_i2c_write(spamp_data->client_p, 0x02, svSetMuten);
		}
		svSetMuten = SHSPAMP_MUTEN_UNMUTE;
	}
	msleep(28);
}
コード例 #3
0
void shspamp_poweroff()
{
	if(spamp_data){
        SpAmp_set_reg0(SPAMP_REG0_DISABLE);
	}
	gpio_set_value(SHSPAMP_PDN, 0);

/* [BatteryTemperatureLog] [start] */
    if (shspamp_shterm_flg == true) {
        shterm_k_set_info( SHTERM_INFO_SPEAKER, 0 );
        shspamp_shterm_flg = false;
    }
/* [BatteryTemperatureLog] [end] */
}
コード例 #4
0
void shspamp_poweroff()
{
	svSetMuten = SHSPAMP_MUTEN_UNMUTE;

	if(spamp_data){
		shspamp_i2c_write(spamp_data->client_p, 0x02, SHSPAMP_MUTEN_MUTE);
	}
	gpio_set_value(SHSPAMP_PDN, 0);

/* [BatteryTemperatureLog] [start] */
    if (shspamp_shterm_flg == true) {
        shterm_k_set_info( SHTERM_INFO_SPEAKER, 0 );
        shspamp_shterm_flg = false;
    }
/* [BatteryTemperatureLog] [end] */
}
コード例 #5
0
static void pmic_vibrator_on(struct work_struct *work)
{
#if defined( SHVIB_PAUSE_PEDOMETER )
	if (!paused_pedometer && pause_pedometer) {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Pause a pedometer.\n");
		AMI602Pedometer_Pause();
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Pause a acclerometer.\n");
		SHMDS_Acclerometer_Control( SHMDS_ACC_PAUSE );
#endif
		paused_pedometer = 1;
	} else {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Don't pause a pedometer.\n");
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Don't pause a acclerometer.\n");
#endif
	}
#endif

/* [BatteryTemperatureLog] [start] */
    if (sh_vibrator_shterm_flg == false) {
        pr_debug("%s() shterm_k_set_info( SHTERM_INFO_VIB, 1 ) \n", __func__);
        shterm_k_set_info( SHTERM_INFO_VIB, 1 );
        sh_vibrator_shterm_flg = true;
    }
/* [BatteryTemperatureLog] [end] */
/* [stop geiger when using speaker/vibration] -> */
#if defined( CONFIG_SENSORS_SHGEIGER )
	ShGeigerPause_Vib();
#endif
/* [stop geiger when using speaker/vibration] <- */

	set_pmic_vibrator(1);
	
	hrtimer_start(&vibe_timer,
		      ktime_set(sh_vibrator_reqtime / 1000, (sh_vibrator_reqtime % 1000) * 1000000),
		      HRTIMER_MODE_REL);
	pr_debug("[shvibrator] timer start. %d \n", sh_vibrator_reqtime);
}
コード例 #6
0
void shspamp_poweron()
{
/* [BatteryTemperatureLog] [start] */
    if (shspamp_shterm_flg == false) {
        shterm_k_set_info( SHTERM_INFO_SPEAKER, 1 );
        shspamp_shterm_flg = true;
    }
/* [BatteryTemperatureLog] [end] */

	gpio_set_value(SHSPAMP_PDN, 1);
	mdelay(25);

/*
	GAIN	"0"(+23)	AN12969
	AGC	"1"(ON)
	AGC_ON	"000"	(12.6dBv)
	AGC_REC	"011"	(3.0sec)
	AGC_ATT	"01"	(1msec)
*/
	if(spamp_data){
		/* write reg-0 */
		if(!SpAmp_set_reg0(SPAMP_REG0_ENABLE))
			return;

		/* Standby sleep */
		usleep(SPAMP_POWER_ON_MARGIN_TIME);

		/* write reg-1 */
		if(!SpAmp_set_reg1())
			return;

		/* write reg-2 */
		if(!SpAmp_set_reg2())
			return;

		/* sp save off */
		if(!SpAmp_set_reg0(SPAMP_REG0_SPSAVE))
			return;
	}
}
コード例 #7
0
void shspamp_poweron()
{
/* [BatteryTemperatureLog] [start] */
    if (shspamp_shterm_flg == false) {
        shterm_k_set_info( SHTERM_INFO_SPEAKER, 1 );
        shspamp_shterm_flg = true;
    }
/* [BatteryTemperatureLog] [end] */

	gpio_set_value(SHSPAMP_PDN, 1);
	msleep(25);
	
	if(spamp_data){
		shspamp_i2c_write(spamp_data->client_p, 0x02, SHSPAMP_MUTEN_MUTE);
#if (CONFIG_SH_AUDIO_DRIVER_MODEL_NUMBER == 103)
		shspamp_i2c_write(spamp_data->client_p, 0x03, 0x0A);
#endif /* CONFIG_SH_AUDIO_DRIVER_MODEL_NUMBER  */
#if (CONFIG_SH_AUDIO_DRIVER_MODEL_NUMBER == 304)
		shspamp_i2c_write(spamp_data->client_p, 0x04, 0x1E);
#elif (CONFIG_SH_AUDIO_DRIVER_MODEL_NUMBER == 306)
		shspamp_i2c_write(spamp_data->client_p, 0x04, 0x26);
#else /* CONFIG_SH_AUDIO_DRIVER_MODEL_NUMBER  */
		shspamp_i2c_write(spamp_data->client_p, 0x04, 0x20);
#endif /* CONFIG_SH_AUDIO_DRIVER_MODEL_NUMBER  */
		shspamp_i2c_write(spamp_data->client_p, 0x05, 0x00);
		shspamp_i2c_write(spamp_data->client_p, 0x06, 0x80);
		shspamp_i2c_write(spamp_data->client_p, 0x02, SHSPAMP_MUTEN_UNMUTE);

		msleep(30);

		if(svSetMuten == SHSPAMP_MUTEN_MUTE)
		{
			shspamp_i2c_write(spamp_data->client_p, 0x02, svSetMuten);
			msleep(30);
		}
		svSetMuten = SHSPAMP_MUTEN_UNMUTE;
	}
}
コード例 #8
0
static void pmic_vibrator_off(struct work_struct *work)
{
	set_pmic_vibrator(0);

/* [stop geiger when using speaker/vibration] -> */
#if defined( CONFIG_SENSORS_SHGEIGER )
	ShGeigerReStart_Vib();
#endif
/* [stop geiger when using speaker/vibration] <- */
/* [BatteryTemperatureLog] [start] */
    if (sh_vibrator_shterm_flg == true) {
        pr_debug("%s() shterm_k_set_info( SHTERM_INFO_VIB, 0 ) \n", __func__);
        shterm_k_set_info( SHTERM_INFO_VIB, 0 );
        sh_vibrator_shterm_flg = false;
    }
/* [BatteryTemperatureLog] [end] */

#if defined( SHVIB_PAUSE_PEDOMETER )
	if (paused_pedometer) {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Restart a pedometer.\n");
		AMI602Pedometer_ReStart();
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Restart a acclerometer.\n");
		SHMDS_Acclerometer_Control( SHMDS_ACC_RESTART );
#endif
		paused_pedometer = 0;
	} else {
#if defined( CONFIG_SENSORS_AMI603 )
		pr_debug("[shvibrator] Don't restart a pedometer.\n");
#elif defined( CONFIG_SH_YAS530 )
		pr_debug("[shvibrator] Don't restart a acclerometer.\n");
#endif
	}
#endif
}
コード例 #9
0
static int shterm_rpc_call( struct msm_rpc_server* svr,
                            struct rpc_request_hdr* req,
                            unsigned len )
{
    int ret;
    shterm_set_info_args *i_args;
    shterm_set_event_args *e_args;
    shbattlog_info_t info = {0};

    switch( req->procedure ){
    case ONCRPC_SHTERM_M2A_SET_INFO_PROC:
        i_args = (shterm_set_info_args *)(req + 1);
        i_args->id = be32_to_cpu( i_args->id );
        i_args->val = be32_to_cpu( i_args->val );
        ret = shterm_k_set_info( i_args->id, i_args->val );
        break;

    case ONCRPC_SHTERM_M2A_SET_EVENT_PROC:
        e_args = (shterm_set_event_args *)(req + 1);
        info.event_num = be32_to_cpu( e_args->event_num );

        switch( info.event_num ){
        case SHBATTLOG_EVENT_HIGH_TEMP:
        case SHBATTLOG_EVENT_FGIC_EX10:
        case SHBATTLOG_EVENT_FGIC_EX20:
        case SHBATTLOG_EVENT_FGIC_EX30:
        case SHBATTLOG_EVENT_FGIC_EX40:
        case SHBATTLOG_EVENT_FGIC_EX50:
        case SHBATTLOG_EVENT_FGIC_EX60:
        case SHBATTLOG_EVENT_FGIC_EX70:
        case SHBATTLOG_EVENT_FGIC_EX80:
        case SHBATTLOG_EVENT_FGIC_EX90:
        case SHBATTLOG_EVENT_FGIC_EX100:
#ifdef CONFIG_SH_DETECT_HIGH_TEMP
        case SHBATTLOG_EVENT_DETECT_HIGH_TEMP:
        case SHBATTLOG_EVENT_DETECT_LOW_TEMP:
#endif /* CONFIG_SH_DETECT_HIGH_TEMP */
            info.bat_vol = be32_to_cpu( e_args->one );
            info.bat_temp = be32_to_cpu( e_args->two );
            info.chg_temp = be32_to_cpu( e_args->thr );
            info.cam_temp = be32_to_cpu( e_args->fou );
            info.pmic_temp = be32_to_cpu( e_args->fiv );
            info.pa_temp = be32_to_cpu( e_args->six );
            info.avg_cur = be32_to_cpu( e_args->sev );
            info.avg_vol = be32_to_cpu( e_args->eig );
            info.vol_per = be32_to_cpu( e_args->nin );
#ifdef CONFIG_SH_DETECT_HIGH_TEMP
            info.tmp_cut = be32_to_cpu( e_args->ten );
#endif /* CONFIG_SH_DETECT_HIGH_TEMP */
            break;

        case SHBATTLOG_EVENT_BATT_REPORT_NORM:
        case SHBATTLOG_EVENT_BATT_REPORT_CHG:
            info.chg_vol = be32_to_cpu( e_args->one );
            info.chg_cur = be32_to_cpu( e_args->two );
            info.latest_cur = be32_to_cpu( e_args->thr );
            info.bat_vol = be32_to_cpu( e_args->fou );
            info.bat_temp = be32_to_cpu( e_args->fiv );
            info.chg_temp = be32_to_cpu( e_args->six );
            info.cam_temp = be32_to_cpu( e_args->sev );
            info.pmic_temp = be32_to_cpu( e_args->eig );
            info.pa_temp = be32_to_cpu( e_args->nin );
            info.avg_cur = be32_to_cpu( e_args->ten );
            info.avg_vol = be32_to_cpu( e_args->ele );
            info.acc_cur = be32_to_cpu( e_args->twe );
            info.vol_per = be32_to_cpu( e_args->thi );
#ifdef CONFIG_SH_DETECT_HIGH_TEMP
            info.tmp_cut = be32_to_cpu( e_args->fot );
#endif /* CONFIG_SH_DETECT_HIGH_TEMP */
            break;

        case SHBATTLOG_EVENT_FATAL_BATT:
        case SHBATTLOG_EVENT_INDICATER_0:
        case SHBATTLOG_EVENT_CHG_IDLE_ST:
        case SHBATTLOG_EVENT_CHG_FAST_ST:
        case SHBATTLOG_EVENT_CHG_END:
        case SHBATTLOG_EVENT_BATT_ID_INVALID:
        case SHBATTLOG_EVENT_CHG_RESTART:
        case SHBATTLOG_EVENT_CHG_ERROR:
        case SHBATTLOG_EVENT_CHG_TRICKLE_ST:
        case SHBATTLOG_EVENT_CHG_MAINT_ST:
        case SHBATTLOG_EVENT_CHG_HOT_FAST_ST:
        case SHBATTLOG_EVENT_CHG_ERR_BD_BAT_UNUSUAL_ST:
        case SHBATTLOG_EVENT_CHG_ERR_BAT_ID_INVALID_ST:
        case SHBATTLOG_EVENT_FGIC_NOMAL:
        case SHBATTLOG_EVENT_FGIC_INVALID:
        case SHBATTLOG_EVENT_CHG_HOT_STOP_ST:
        case SHBATTLOG_EVENT_CHG_COLD_STOP_ST:
        case SHBATTLOG_EVENT_CHG_MAINT_STOP_ST:
        case SHBATTLOG_EVENT_CHG_MAINT_HOT_STOP_ST:
        case SHBATTLOG_EVENT_CHG_MAINT_COLD_STOP_ST:
            info.bat_vol = be32_to_cpu( e_args->one );
            info.bat_temp = be32_to_cpu( e_args->two );
            info.chg_temp = be32_to_cpu( e_args->thr );
            info.cam_temp = be32_to_cpu( e_args->fou );
            info.pmic_temp = be32_to_cpu( e_args->fiv );
            info.pa_temp = be32_to_cpu( e_args->six );
            info.vol_per = be32_to_cpu( e_args->sev );
            break;

        case SHBATTLOG_EVENT_CHG_INSERT_USB:
        case SHBATTLOG_EVENT_CHG_START:
        case SHBATTLOG_EVENT_CHG_REMOVE_USB:
        case SHBATTLOG_EVENT_CHG_INSERT_CHGR:
        case SHBATTLOG_EVENT_CHG_REMOVE_CHGR:
        case SHBATTLOG_EVENT_CHG_ERR_BD_CHG_UNUSUAL_ST:
        case SHBATTLOG_EVENT_CHG_ERR_CHG_POWER_SHORTAGE_ST:
        case SHBATTLOG_EVENT_CHG_COUNT_OVER_STOP_ST:
        case SHBATTLOG_EVENT_CHGR_OSCILLATION:
            info.bat_vol = be32_to_cpu( e_args->one );
            info.bat_temp = be32_to_cpu( e_args->two );
            info.chg_temp = be32_to_cpu( e_args->thr );
            info.cam_temp = be32_to_cpu( e_args->fou );
            info.pmic_temp = be32_to_cpu( e_args->fiv );
            info.pa_temp = be32_to_cpu( e_args->six );
            info.chg_vol = be32_to_cpu( e_args->sev );
            info.chg_cur = be32_to_cpu( e_args->eig );
            info.vol_per = be32_to_cpu( e_args->nin );
            break;

        case SHBATTLOG_EVENT_OVER_CURRENT1:
        case SHBATTLOG_EVENT_OVER_CURR1_DET:
        case SHBATTLOG_EVENT_OVER_CURR1_RELEASE:
        case SHBATTLOG_EVENT_CHG_COMP:
        case SHBATTLOG_EVENT_BATT_REPORT_DETERIORATED:
        case SHBATTLOG_EVENT_CHG_HOT_ADD_FAST_ST:
            info.bat_vol = be32_to_cpu( e_args->one );
            info.bat_temp = be32_to_cpu( e_args->two );
            info.chg_temp = be32_to_cpu( e_args->thr );
            info.cam_temp = be32_to_cpu( e_args->fou );
            info.pmic_temp = be32_to_cpu( e_args->fiv );
            info.pa_temp = be32_to_cpu( e_args->six );
            info.latest_cur = be32_to_cpu( e_args->sev );
            info.vol_per = be32_to_cpu( e_args->eig );
            break;

        default:
            break;
        }
        ret = shterm_k_set_event( &info );
        break;

    default:
        ret = -1;
        break;
    }

    return 0;
}