@@ -424,7 +424,8 @@ struct trf7970a {
424424 enum trf7970a_state state ;
425425 struct device * dev ;
426426 struct spi_device * spi ;
427- struct regulator * regulator ;
427+ struct regulator * vin_regulator ;
428+ struct regulator * vddio_regulator ;
428429 struct nfc_digital_dev * ddev ;
429430 u32 quirks ;
430431 bool is_initiator ;
@@ -1883,7 +1884,7 @@ static int trf7970a_power_up(struct trf7970a *trf)
18831884 if (trf -> state != TRF7970A_ST_PWR_OFF )
18841885 return 0 ;
18851886
1886- ret = regulator_enable (trf -> regulator );
1887+ ret = regulator_enable (trf -> vin_regulator );
18871888 if (ret ) {
18881889 dev_err (trf -> dev , "%s - Can't enable VIN: %d\n" , __func__ , ret );
18891890 return ret ;
@@ -1926,7 +1927,7 @@ static int trf7970a_power_down(struct trf7970a *trf)
19261927 if (trf -> en2_gpiod && !(trf -> quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW ))
19271928 gpiod_set_value_cansleep (trf -> en2_gpiod , 0 );
19281929
1929- ret = regulator_disable (trf -> regulator );
1930+ ret = regulator_disable (trf -> vin_regulator );
19301931 if (ret )
19311932 dev_err (trf -> dev , "%s - Can't disable VIN: %d\n" , __func__ ,
19321933 ret );
@@ -2065,37 +2066,37 @@ static int trf7970a_probe(struct spi_device *spi)
20652066 mutex_init (& trf -> lock );
20662067 INIT_DELAYED_WORK (& trf -> timeout_work , trf7970a_timeout_work_handler );
20672068
2068- trf -> regulator = devm_regulator_get (& spi -> dev , "vin" );
2069- if (IS_ERR (trf -> regulator )) {
2070- ret = PTR_ERR (trf -> regulator );
2069+ trf -> vin_regulator = devm_regulator_get (& spi -> dev , "vin" );
2070+ if (IS_ERR (trf -> vin_regulator )) {
2071+ ret = PTR_ERR (trf -> vin_regulator );
20712072 dev_err (trf -> dev , "Can't get VIN regulator: %d\n" , ret );
20722073 goto err_destroy_lock ;
20732074 }
20742075
2075- ret = regulator_enable (trf -> regulator );
2076+ ret = regulator_enable (trf -> vin_regulator );
20762077 if (ret ) {
20772078 dev_err (trf -> dev , "Can't enable VIN: %d\n" , ret );
20782079 goto err_destroy_lock ;
20792080 }
20802081
2081- uvolts = regulator_get_voltage (trf -> regulator );
2082+ uvolts = regulator_get_voltage (trf -> vin_regulator );
20822083 if (uvolts > 4000000 )
20832084 trf -> chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3 ;
20842085
2085- trf -> regulator = devm_regulator_get (& spi -> dev , "vdd-io" );
2086- if (IS_ERR (trf -> regulator )) {
2087- ret = PTR_ERR (trf -> regulator );
2086+ trf -> vddio_regulator = devm_regulator_get (& spi -> dev , "vdd-io" );
2087+ if (IS_ERR (trf -> vddio_regulator )) {
2088+ ret = PTR_ERR (trf -> vddio_regulator );
20882089 dev_err (trf -> dev , "Can't get VDD_IO regulator: %d\n" , ret );
2089- goto err_destroy_lock ;
2090+ goto err_disable_vin_regulator ;
20902091 }
20912092
2092- ret = regulator_enable (trf -> regulator );
2093+ ret = regulator_enable (trf -> vddio_regulator );
20932094 if (ret ) {
20942095 dev_err (trf -> dev , "Can't enable VDD_IO: %d\n" , ret );
2095- goto err_destroy_lock ;
2096+ goto err_disable_vin_regulator ;
20962097 }
20972098
2098- if (regulator_get_voltage (trf -> regulator ) == 1800000 ) {
2099+ if (regulator_get_voltage (trf -> vddio_regulator ) == 1800000 ) {
20992100 trf -> io_ctrl = TRF7970A_REG_IO_CTRL_IO_LOW ;
21002101 dev_dbg (trf -> dev , "trf7970a config vdd_io to 1.8V\n" );
21012102 }
@@ -2108,7 +2109,7 @@ static int trf7970a_probe(struct spi_device *spi)
21082109 if (!trf -> ddev ) {
21092110 dev_err (trf -> dev , "Can't allocate NFC digital device\n" );
21102111 ret = - ENOMEM ;
2111- goto err_disable_regulator ;
2112+ goto err_disable_vddio_regulator ;
21122113 }
21132114
21142115 nfc_digital_set_parent_dev (trf -> ddev , trf -> dev );
@@ -2137,8 +2138,10 @@ static int trf7970a_probe(struct spi_device *spi)
21372138 trf7970a_shutdown (trf );
21382139err_free_ddev :
21392140 nfc_digital_free_device (trf -> ddev );
2140- err_disable_regulator :
2141- regulator_disable (trf -> regulator );
2141+ err_disable_vddio_regulator :
2142+ regulator_disable (trf -> vddio_regulator );
2143+ err_disable_vin_regulator :
2144+ regulator_disable (trf -> vin_regulator );
21422145err_destroy_lock :
21432146 mutex_destroy (& trf -> lock );
21442147 return ret ;
@@ -2157,7 +2160,8 @@ static void trf7970a_remove(struct spi_device *spi)
21572160 nfc_digital_unregister_device (trf -> ddev );
21582161 nfc_digital_free_device (trf -> ddev );
21592162
2160- regulator_disable (trf -> regulator );
2163+ regulator_disable (trf -> vddio_regulator );
2164+ regulator_disable (trf -> vin_regulator );
21612165
21622166 mutex_destroy (& trf -> lock );
21632167}
0 commit comments