@@ -78,7 +78,7 @@ struct ab8500_btemp_ranges {
7878 * @parent: Pointer to the struct ab8500
7979 * @gpadc: Pointer to the struct gpadc
8080 * @fg: Pointer to the struct fg
81- * @bat: Pointer to the abx500_bm platform data
81+ * @bm: Platform specific battery management information
8282 * @btemp_psy: Structure for BTEMP specific battery properties
8383 * @events: Structure for information about events triggered
8484 * @btemp_ranges: Battery temperature range structure
@@ -95,7 +95,7 @@ struct ab8500_btemp {
9595 struct ab8500 * parent ;
9696 struct ab8500_gpadc * gpadc ;
9797 struct ab8500_fg * fg ;
98- struct abx500_bm_data * bat ;
98+ struct abx500_bm_data * bm ;
9999 struct power_supply btemp_psy ;
100100 struct ab8500_btemp_events events ;
101101 struct ab8500_btemp_ranges btemp_ranges ;
@@ -149,13 +149,13 @@ static int ab8500_btemp_batctrl_volt_to_res(struct ab8500_btemp *di,
149149 return (450000 * (v_batctrl )) / (1800 - v_batctrl );
150150 }
151151
152- if (di -> bat -> adc_therm == ABx500_ADC_THERM_BATCTRL ) {
152+ if (di -> bm -> adc_therm == ABx500_ADC_THERM_BATCTRL ) {
153153 /*
154154 * If the battery has internal NTC, we use the current
155155 * source to calculate the resistance, 7uA or 20uA
156156 */
157157 rbs = (v_batctrl * 1000
158- - di -> bat -> gnd_lift_resistance * inst_curr )
158+ - di -> bm -> gnd_lift_resistance * inst_curr )
159159 / di -> curr_source ;
160160 } else {
161161 /*
@@ -211,7 +211,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
211211 return 0 ;
212212
213213 /* Only do this for batteries with internal NTC */
214- if (di -> bat -> adc_therm == ABx500_ADC_THERM_BATCTRL && enable ) {
214+ if (di -> bm -> adc_therm == ABx500_ADC_THERM_BATCTRL && enable ) {
215215 if (di -> curr_source == BTEMP_BATCTRL_CURR_SRC_7UA )
216216 curr = BAT_CTRL_7U_ENA ;
217217 else
@@ -243,7 +243,7 @@ static int ab8500_btemp_curr_source_enable(struct ab8500_btemp *di,
243243 __func__ );
244244 goto disable_curr_source ;
245245 }
246- } else if (di -> bat -> adc_therm == ABx500_ADC_THERM_BATCTRL && !enable ) {
246+ } else if (di -> bm -> adc_therm == ABx500_ADC_THERM_BATCTRL && !enable ) {
247247 dev_dbg (di -> dev , "Disable BATCTRL curr source\n" );
248248
249249 /* Write 0 to the curr bits */
@@ -459,9 +459,9 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
459459 int rbat , rntc , vntc ;
460460 u8 id ;
461461
462- id = di -> bat -> batt_id ;
462+ id = di -> bm -> batt_id ;
463463
464- if (di -> bat -> adc_therm == ABx500_ADC_THERM_BATCTRL &&
464+ if (di -> bm -> adc_therm == ABx500_ADC_THERM_BATCTRL &&
465465 id != BATTERY_UNKNOWN ) {
466466
467467 rbat = ab8500_btemp_get_batctrl_res (di );
@@ -476,8 +476,8 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
476476 }
477477
478478 temp = ab8500_btemp_res_to_temp (di ,
479- di -> bat -> bat_type [id ].r_to_t_tbl ,
480- di -> bat -> bat_type [id ].n_temp_tbl_elements , rbat );
479+ di -> bm -> bat_type [id ].r_to_t_tbl ,
480+ di -> bm -> bat_type [id ].n_temp_tbl_elements , rbat );
481481 } else {
482482 vntc = ab8500_gpadc_convert (di -> gpadc , BTEMP_BALL );
483483 if (vntc < 0 ) {
@@ -493,8 +493,8 @@ static int ab8500_btemp_measure_temp(struct ab8500_btemp *di)
493493 rntc = 230000 * vntc / (VTVOUT_V - vntc );
494494
495495 temp = ab8500_btemp_res_to_temp (di ,
496- di -> bat -> bat_type [id ].r_to_t_tbl ,
497- di -> bat -> bat_type [id ].n_temp_tbl_elements , rntc );
496+ di -> bm -> bat_type [id ].r_to_t_tbl ,
497+ di -> bm -> bat_type [id ].n_temp_tbl_elements , rntc );
498498 prev = temp ;
499499 }
500500 dev_dbg (di -> dev , "Battery temperature is %d\n" , temp );
@@ -515,7 +515,7 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
515515 u8 i ;
516516
517517 di -> curr_source = BTEMP_BATCTRL_CURR_SRC_7UA ;
518- di -> bat -> batt_id = BATTERY_UNKNOWN ;
518+ di -> bm -> batt_id = BATTERY_UNKNOWN ;
519519
520520 res = ab8500_btemp_get_batctrl_res (di );
521521 if (res < 0 ) {
@@ -524,23 +524,23 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
524524 }
525525
526526 /* BATTERY_UNKNOWN is defined on position 0, skip it! */
527- for (i = BATTERY_UNKNOWN + 1 ; i < di -> bat -> n_btypes ; i ++ ) {
528- if ((res <= di -> bat -> bat_type [i ].resis_high ) &&
529- (res >= di -> bat -> bat_type [i ].resis_low )) {
527+ for (i = BATTERY_UNKNOWN + 1 ; i < di -> bm -> n_btypes ; i ++ ) {
528+ if ((res <= di -> bm -> bat_type [i ].resis_high ) &&
529+ (res >= di -> bm -> bat_type [i ].resis_low )) {
530530 dev_dbg (di -> dev , "Battery detected on %s"
531531 " low %d < res %d < high: %d"
532532 " index: %d\n" ,
533- di -> bat -> adc_therm == ABx500_ADC_THERM_BATCTRL ?
533+ di -> bm -> adc_therm == ABx500_ADC_THERM_BATCTRL ?
534534 "BATCTRL" : "BATTEMP" ,
535- di -> bat -> bat_type [i ].resis_low , res ,
536- di -> bat -> bat_type [i ].resis_high , i );
535+ di -> bm -> bat_type [i ].resis_low , res ,
536+ di -> bm -> bat_type [i ].resis_high , i );
537537
538- di -> bat -> batt_id = i ;
538+ di -> bm -> batt_id = i ;
539539 break ;
540540 }
541541 }
542542
543- if (di -> bat -> batt_id == BATTERY_UNKNOWN ) {
543+ if (di -> bm -> batt_id == BATTERY_UNKNOWN ) {
544544 dev_warn (di -> dev , "Battery identified as unknown"
545545 ", resistance %d Ohm\n" , res );
546546 return - ENXIO ;
@@ -550,13 +550,13 @@ static int ab8500_btemp_id(struct ab8500_btemp *di)
550550 * We only have to change current source if the
551551 * detected type is Type 1, else we use the 7uA source
552552 */
553- if (di -> bat -> adc_therm == ABx500_ADC_THERM_BATCTRL &&
554- di -> bat -> batt_id == 1 ) {
553+ if (di -> bm -> adc_therm == ABx500_ADC_THERM_BATCTRL &&
554+ di -> bm -> batt_id == 1 ) {
555555 dev_dbg (di -> dev , "Set BATCTRL current source to 20uA\n" );
556556 di -> curr_source = BTEMP_BATCTRL_CURR_SRC_20UA ;
557557 }
558558
559- return di -> bat -> batt_id ;
559+ return di -> bm -> batt_id ;
560560}
561561
562562/**
@@ -586,9 +586,9 @@ static void ab8500_btemp_periodic_work(struct work_struct *work)
586586 }
587587
588588 if (di -> events .ac_conn || di -> events .usb_conn )
589- interval = di -> bat -> temp_interval_chg ;
589+ interval = di -> bm -> temp_interval_chg ;
590590 else
591- interval = di -> bat -> temp_interval_nochg ;
591+ interval = di -> bm -> temp_interval_nochg ;
592592
593593 /* Schedule a new measurement */
594594 queue_delayed_work (di -> btemp_wq ,
@@ -815,7 +815,7 @@ static int ab8500_btemp_get_property(struct power_supply *psy,
815815 val -> intval = 1 ;
816816 break ;
817817 case POWER_SUPPLY_PROP_TECHNOLOGY :
818- val -> intval = di -> bat -> bat_type [di -> bat -> batt_id ].name ;
818+ val -> intval = di -> bm -> bat_type [di -> bm -> batt_id ].name ;
819819 break ;
820820 case POWER_SUPPLY_PROP_TEMP :
821821 val -> intval = ab8500_btemp_get_temp (di );
@@ -985,10 +985,10 @@ static int __devinit ab8500_btemp_probe(struct platform_device *pdev)
985985 dev_err (& pdev -> dev , "%s no mem for ab8500_btemp\n" , __func__ );
986986 return - ENOMEM ;
987987 }
988- di -> bat = pdev -> mfd_cell -> platform_data ;
989- if (!di -> bat ) {
988+ di -> bm = pdev -> mfd_cell -> platform_data ;
989+ if (!di -> bm ) {
990990 if (np ) {
991- ret = bmdevs_of_probe (& pdev -> dev , np , & di -> bat );
991+ ret = ab8500_bm_of_probe (& pdev -> dev , np , & di -> bm );
992992 if (ret ) {
993993 dev_err (& pdev -> dev ,
994994 "failed to get battery information\n" );
0 commit comments