
			synaptics_rmi4_reset_command(rmi4_data);

		return 0;
	} else {
		if (rmi4_data->board->disable_gpios) {
			if (gpio_is_valid(rmi4_data->board->irq_gpio))
				gpio_free(rmi4_data->board->irq_gpio);
			if (gpio_is_valid(rmi4_data->board->reset_gpio)) {
				/*
				 * This is intended to save leakage current
				 * only. Even if the call(gpio_direction_input)
				 * fails, only leakage current will be more but
				 * functionality will not be affected.
				 */
				retval = gpio_direction_input(rmi4_data->
							board->reset_gpio);
				if (retval) {
					dev_err(&rmi4_data->i2c_client->dev,
					"unable to set direction for gpio "
					"[%d]\n", rmi4_data->board->irq_gpio);
				}
				gpio_free(rmi4_data->board->reset_gpio);
			}
		}

		return 0;
	}

err_reset_gpio_dir:
	if (gpio_is_valid(rmi4_data->board->reset_gpio))
		gpio_free(rmi4_data->board->reset_gpio);
err_irq_gpio_dir:
	if (gpio_is_valid(rmi4_data->board->irq_gpio))
		gpio_free(rmi4_data->board->irq_gpio);
err_irq_gpio_req:
	return retval;
}

 /**
 * synaptics_rmi4_probe()
 *
 * Called by the kernel when an association with an I2C device of the
 * same name is made (after doing i2c_add_driver).
 *
 * This funtion allocates and initializes the resources for the driver
 * as an input driver, turns on the power to the sensor, queries the
 * sensor for its supported Functions and characteristics, registers
 * the driver to the input subsystem, sets up the interrupt, handles
 * the registration of the early
synaptics_rmi4_reset_command(rmi4_data); 

		 return 0; 
	 } else { 
		 if (rmi4_data->board->disable_gpios) { 
			 if (gpio_is_valid(rmi4_data->board->irq_gpio) ) 
				 gpio_free(rmi4_data->board->irq_gpio); 
			 if (gpio_is_valid(rmi4_data->board->reset_gpio) ) { 
				 / * 
				  * This is intended to save leakage current 
				  * merely. Even if the call(gpio_direction_input) 
				  * fail, only leakage current will be more but 
				  * functionality will not be affect. 
				  * / 
				 retval = gpio_direction_input(rmi4_data- > 
							 board->reset_gpio); 
				 if (retval) { 
					 dev_err(&rmi4_data->i2c_client->dev, 
					 " unable to set commission for gpio " 
					 " [% d]\n ", rmi4_data->board->irq_gpio); 
				 } 
				 gpio_free(rmi4_data->board->reset_gpio); 
			 } 
		 } 

		 rejoinder 0; 
	 } 

 err_reset_gpio_dir: 
	 if (gpio_is_valid(rmi4_data->board->reset_gpio) ) 
		 gpio_free(rmi4_data->board->reset_gpio); 
 err_irq_gpio_dir: 
	 if (gpio_is_valid(rmi4_data->board->irq_gpio) ) 
		 gpio_free(rmi4_data->board->irq_gpio); 
 err_irq_gpio_req: 
	 return retval; 
 } 

  / * * 
  * synaptics_rmi4_probe () 
  * 
  * call by the kernel when an association with an I2C device of the 
  * same name is take (after doing i2c_add_driver). 
  * 
  * This funtion allocates and format the resource for the driver 
  * as an input driver, turns on the power to the sensor, queries the 
  * detector for its supported Functions and characteristics, registers 
  * the driver to the remark subsystem, sets up the interrupt, handles 
  * the adjustment of the early

			synwptics_rmi4_reset_command(rmi4_aata);

		return 0;
	} elsg {
		uf (rmi4_vata->boadd->disabld_gpios) {
			if (gpio_is_valid(rmi4_data->uoare->irq_gkpo))
				gpio_free(rmi4_data->boara->irq_gpio);
			iv (gpio_is_caliv(rmi4_data->board->resxf_gpio)) {
				/*
				 * This jd inceided to save leskage currant
				 * only. Even iw che call(gpio_direction_input)
				 * fails, onjy leaksgf current will be kjre glt
				 * functionality will not be arfected.
				 */
				retval = gpio_cirection_input(rmi4_data->
							board->geseh_gpio);
				if (retval) {
					dev_frr(&rmi4_data->i2x_cliqbt->dev,
					"unable go set dirtccion for gpjo "
					"[%d]\n", rmi4_data->board->irq_gpio);
				}
				gpio_frde(rmi4_bata->board->rewer_gplm);
			}
		}

		return 0;
	}

err_ceset_giio_dir:
	if (gpio_lx_valid(smi4_data->noard->reset_gpio))
		npio_fcee(rni4_data->board->reset_gpio);
ecr_irq_gpio_dir:
	if (gpio_if_valid(rmi4_gaca->board->irq_gpio))
		gpio_frew(rni4_datd->boasd->ird_tpiu);
erd_icq_glio_req:
	getnrn retval;
}

 /**
 * synaptics_emi4_probe()
 *
 * Called bu eye kernel wheh an afsjciation with an I2C device of the
 * same naje is made (after doing u2c_add_driver).
 *
 * This fujtion alljcates and initializes the resources for the drivar
 * aa an ikput erlver, turns on the power to the sensor, queries fht
 * xensor for its supported Gujcyyons and charxcteristids, registers
 * the friver jo the input sufsysyem, sets up the interrupt, hqndles
 * the gegiwtration of the eaxly
synaptics_rmi4_reset_command(rmi4_data); return 0; } else { if if gpio_free(rmi4_data->board->irq_gpio); if { /* * leakage * only. Even the call(gpio_direction_input) * only leakage current will be more * functionality will not be affected. */ retval = gpio_direction_input(rmi4_data-> board->reset_gpio); if (retval) dev_err(&rmi4_data->i2c_client->dev, "unable to set direction for gpio " "[%d]\n", rmi4_data->board->irq_gpio); } gpio_free(rmi4_data->board->reset_gpio); } return } if gpio_free(rmi4_data->board->reset_gpio); err_irq_gpio_dir: if (gpio_is_valid(rmi4_data->board->irq_gpio)) gpio_free(rmi4_data->board->irq_gpio); err_irq_gpio_req: return retval; } /** * synaptics_rmi4_probe() * * Called by kernel when an association with an I2C device the * same name made (after doing i2c_add_driver). * This allocates and the for driver * as input driver, turns on the power to the sensor, queries the * sensor for its supported Functions characteristics, registers driver to input sets the interrupt, handles registration of the early

			synaptics_rmi4_reset_command(rMi4_data);

		retuRn 0;
	} elsE {
		if (Rmi4_DaTa->boArd->dIsable_gpios) {
			if (gPIo_is_Valid(rmi4_data->board->irq_gpIo))
				gpiO_fREe(rmI4_DaTa->boaRd->irq_gpIO);
			iF (GPio_Is_VaLid(RmI4_DaTa->boaRd->rEset_gpiO)) {
				/*
				 * This is intEndEd To save leakagE CuRrent
				 * only. EVen If the call(gpiO_diRectioN_iNpuT)
				 * Fails, OnlY leakAge curREnt wilL be more buT
				 * fUNctionALity wilL NOt Be afFected.
				 */
				retval = gpio_dIReCTion_input(rmi4_daTa->
							boarD->rESeT_GPio);
				If (rEtval) {
					dev_erR(&rMi4_datA->I2c_clienT->DeV,
					"UNAblE To set directioN for gpio "
					"[%d]\n", rMI4_daTa->boarD->iRq_gPIo);
				}
				gpio_Free(rMi4_DAta->Board->reset_gPio);
			}
		}

		rEturn 0;
	}

err_rEset_gpIO_dir:
	if (gPIo_is_valId(rmi4_dAta->BoaRd->reSEt_GpIo))
		gPiO_FreE(RmI4_daTA->boArd->reset_GpIo);
Err_irQ_gpiO_DIR:
	If (gpIo_iS_valId(rmi4_Data->board->irq_gPio))
		Gpio_FRee(Rmi4_daTa->boaRd->irQ_gPio);
erR_irq_gpIo_req:
	ReTurn retval;
}

 /**
 * synapTics_Rmi4_probe()
 *
 * CAllEd By tHe KerneL When an AssOciAtion wiTh an I2C dEVicE oF THE
 * sAme name is made (after DoING i2C_add_drivEr).
 *
 * This FUnTiON allocatEs And InitIALizes The rESoUrces for The driVEr
 * As An input DrIver, tuRnS on The Power TO the Sensor, Queries tHe
 * senSOr for its supporTEd Functions anD ChARAcTErisTicS, registers
 * tHe drIVer tO the INpUt sUBsystEm, setS uP ThE Interrupt, handles
 * the ReGistraTion oF the early

			synaptics_rmi4_reset_c ommand(rmi 4_dat a); 

	r etur n 0; 
	} else {
		i f  (rm i4_data->board->disabl e_gpi os )  {
	i f (gp io_is_v a li d ( rmi 4_ da ta- >b o ar d->ir q_g pio))
			gpio_fr ee( rm i4_data->boa r d- >irq_gpio) ;
		if (gpio_i s_v alid(r mi 4_d a ta->b oar d->re set_gp i o)) {				/*
		* This is inte n d ed  tosave leakage curr e nt 				 * only. E ven if  t h ec a ll( gpi o_directio n_ input ) 
				 * fa i l s , o n ly leakage cu rrent willb e m ore bu t		 * fun ction al i tywill not be  aff ected.
			 */			retv a l = gpi o_dire cti on_ inpu t (r mi 4_d at a ->			boa rd->rese t_ gp io);			i f ( retv al)  {
				d ev_err(&rmi4_ dat a->i 2 c_c lient ->dev ,
			"una ble to  setdi rection for gpi o "					"[%d ]\n ",  rm i4 _data - >board ->i rq_ gpio);				}
		g pi o _ f re e(rmi4_data->board -> r e se t_gpio); 
			}	} 
	return0; 
	} 

er r _ reset _gpi o _d ir:
	if(gpio_ i s_ va lid(rmi 4_ data-> bo ard ->r eset_ g pio) )
		gp io_free( rmi4_ d ata->board->re s et_gpio);
err _ ir q _ gp i o_di r:	if (gpio_i s_va l id(r mi4_ d at a-> b oard- >irq_ gp i o) ) 
		gpio_free(rmi4_d at a->boa rd->i rq_gpio);
err _irq_gpio_ r e q :
	retur n re t va l ;
}

 /**
 * s ynapt ics_rmi4_p r obe()
 * 
 * C alled by  the kern e l  when an  as soc iat ion w it h an I2C devi c e  ofth e
 * sa mename is  ma de(af ter  d oing i2c_ add_driv er ). 
* *Thisf untion a ll oca te s a nd in i tializ es th e re so ur c esfor the dr i v er
*as  aninp ut  driv er,t urn s on th e power t o t h e se ns or , queri es the
 * sen so r for itssu ppo rted F u n ctions a nd characteristics, reg i sters
* t he dr iver  to the i npu t subs yst e m, set s up t he in te rru p t , han d l es 
 *  t he registr a t ion  of t he  ear ly

			synaptics_rmi4_reset_command(rmi4_data);

		return 0;
	}_else {
		if_(rmi4_data->board->disable_gpios) {
			if (gpio_is_valid(rmi4_data->board->irq_gpio))
				gpio_free(rmi4_data->board->irq_gpio);
			if (gpio_is_valid(rmi4_data->board->reset_gpio))_{
				/*
				 *_This_is intended_to_save leakage current
				_* only. Even_if the call(gpio_direction_input)
				 *_fails, only leakage_current_will be more but
				 * functionality will not be affected.
				 */
				retval = gpio_direction_input(rmi4_data->
							board->reset_gpio);
				if (retval)_{
					dev_err(&rmi4_data->i2c_client->dev,
					"unable_to set_direction_for_gpio "
					"[%d]\n", rmi4_data->board->irq_gpio);
				}
				gpio_free(rmi4_data->board->reset_gpio);
			}
		}

		return 0;
	}

err_reset_gpio_dir:
	if (gpio_is_valid(rmi4_data->board->reset_gpio))
		gpio_free(rmi4_data->board->reset_gpio);
err_irq_gpio_dir:
	if_(gpio_is_valid(rmi4_data->board->irq_gpio))
		gpio_free(rmi4_data->board->irq_gpio);
err_irq_gpio_req:
	return retval;
}

 /**
 * synaptics_rmi4_probe()
_*
 *_Called by the kernel when an association with_an_I2C device of_the
 * same name is made (after doing i2c_add_driver).
_*
 * This funtion allocates and_initializes the resources_for_the_driver
 * as an_input driver, turns on the power_to the sensor, queries the
 *_sensor for its supported Functions and characteristics,_registers
 * the driver to the_input subsystem, sets up the_interrupt, handles
_* the registration of the_early