Exemplo n.º 1
0
static int qpnp_haptic_suspend(struct device *dev)
{
	struct qpnp_hap *hap = dev_get_drvdata(dev);

	hrtimer_cancel(&hap->hap_timer);
	cancel_work_sync(&hap->work);
	/* turn-off haptic */
	qpnp_hap_set(hap, 0);

	return 0;
}
/* worker to opeate haptics */
static void qpnp_hap_worker(struct work_struct *work)
{
	struct qpnp_hap *hap = container_of(work, struct qpnp_hap,
					 work);
	u8 reg = 0;
	int rc;

	if (hap->play_mode == QPNP_HAP_DIRECT) {
		if (hap->state) {
			/* haptic on */

			rc = qpnp_hap_read_reg(hap, &reg,
						QPNP_HAP_STATUS(hap->base));
			if (rc < 0)
				return;

			if ((reg & QPNP_HAP_STATUS_BUSY) == 0) {
				/*                        */
#if 0
				/* Over Drive : 2 vmax */
				hap->vmax_mv = hap->vmax_mv_orig * 2;
#endif
				/*                                    */
				hap->vmax_mv =QPNP_HAP_OV_RB_MV;

				qpnp_hap_vmax_config(hap ,1);

				qpnp_hap_set(hap, 1);
				/*                             */
				usleep(2*hap->wave_play_rate_us);

				/* recover original vmax */
				hap->vmax_mv = hap->vmax_mv_orig;
				qpnp_hap_vmax_config(hap ,0 );
			}
		}
	}
	qpnp_hap_set(hap, hap->state);
}
Exemplo n.º 3
0
/* worker to opeate haptics */
static void qpnp_hap_worker(struct work_struct *work)
{
	struct qpnp_hap *hap = container_of(work, struct qpnp_hap,
					 work);
	qpnp_hap_set(hap, hap->state);
}