@@ -424,7 +424,8 @@ struct trf7970a {
424
424
enum trf7970a_state state ;
425
425
struct device * dev ;
426
426
struct spi_device * spi ;
427
- struct regulator * regulator ;
427
+ struct regulator * vin_regulator ;
428
+ struct regulator * vddio_regulator ;
428
429
struct nfc_digital_dev * ddev ;
429
430
u32 quirks ;
430
431
bool is_initiator ;
@@ -1883,7 +1884,7 @@ static int trf7970a_power_up(struct trf7970a *trf)
1883
1884
if (trf -> state != TRF7970A_ST_PWR_OFF )
1884
1885
return 0 ;
1885
1886
1886
- ret = regulator_enable (trf -> regulator );
1887
+ ret = regulator_enable (trf -> vin_regulator );
1887
1888
if (ret ) {
1888
1889
dev_err (trf -> dev , "%s - Can't enable VIN: %d\n" , __func__ , ret );
1889
1890
return ret ;
@@ -1926,7 +1927,7 @@ static int trf7970a_power_down(struct trf7970a *trf)
1926
1927
if (trf -> en2_gpiod && !(trf -> quirks & TRF7970A_QUIRK_EN2_MUST_STAY_LOW ))
1927
1928
gpiod_set_value_cansleep (trf -> en2_gpiod , 0 );
1928
1929
1929
- ret = regulator_disable (trf -> regulator );
1930
+ ret = regulator_disable (trf -> vin_regulator );
1930
1931
if (ret )
1931
1932
dev_err (trf -> dev , "%s - Can't disable VIN: %d\n" , __func__ ,
1932
1933
ret );
@@ -2065,37 +2066,37 @@ static int trf7970a_probe(struct spi_device *spi)
2065
2066
mutex_init (& trf -> lock );
2066
2067
INIT_DELAYED_WORK (& trf -> timeout_work , trf7970a_timeout_work_handler );
2067
2068
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 );
2071
2072
dev_err (trf -> dev , "Can't get VIN regulator: %d\n" , ret );
2072
2073
goto err_destroy_lock ;
2073
2074
}
2074
2075
2075
- ret = regulator_enable (trf -> regulator );
2076
+ ret = regulator_enable (trf -> vin_regulator );
2076
2077
if (ret ) {
2077
2078
dev_err (trf -> dev , "Can't enable VIN: %d\n" , ret );
2078
2079
goto err_destroy_lock ;
2079
2080
}
2080
2081
2081
- uvolts = regulator_get_voltage (trf -> regulator );
2082
+ uvolts = regulator_get_voltage (trf -> vin_regulator );
2082
2083
if (uvolts > 4000000 )
2083
2084
trf -> chip_status_ctrl = TRF7970A_CHIP_STATUS_VRS5_3 ;
2084
2085
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 );
2088
2089
dev_err (trf -> dev , "Can't get VDD_IO regulator: %d\n" , ret );
2089
- goto err_destroy_lock ;
2090
+ goto err_disable_vin_regulator ;
2090
2091
}
2091
2092
2092
- ret = regulator_enable (trf -> regulator );
2093
+ ret = regulator_enable (trf -> vddio_regulator );
2093
2094
if (ret ) {
2094
2095
dev_err (trf -> dev , "Can't enable VDD_IO: %d\n" , ret );
2095
- goto err_destroy_lock ;
2096
+ goto err_disable_vin_regulator ;
2096
2097
}
2097
2098
2098
- if (regulator_get_voltage (trf -> regulator ) == 1800000 ) {
2099
+ if (regulator_get_voltage (trf -> vddio_regulator ) == 1800000 ) {
2099
2100
trf -> io_ctrl = TRF7970A_REG_IO_CTRL_IO_LOW ;
2100
2101
dev_dbg (trf -> dev , "trf7970a config vdd_io to 1.8V\n" );
2101
2102
}
@@ -2108,7 +2109,7 @@ static int trf7970a_probe(struct spi_device *spi)
2108
2109
if (!trf -> ddev ) {
2109
2110
dev_err (trf -> dev , "Can't allocate NFC digital device\n" );
2110
2111
ret = - ENOMEM ;
2111
- goto err_disable_regulator ;
2112
+ goto err_disable_vddio_regulator ;
2112
2113
}
2113
2114
2114
2115
nfc_digital_set_parent_dev (trf -> ddev , trf -> dev );
@@ -2137,8 +2138,10 @@ static int trf7970a_probe(struct spi_device *spi)
2137
2138
trf7970a_shutdown (trf );
2138
2139
err_free_ddev :
2139
2140
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 );
2142
2145
err_destroy_lock :
2143
2146
mutex_destroy (& trf -> lock );
2144
2147
return ret ;
@@ -2157,7 +2160,8 @@ static void trf7970a_remove(struct spi_device *spi)
2157
2160
nfc_digital_unregister_device (trf -> ddev );
2158
2161
nfc_digital_free_device (trf -> ddev );
2159
2162
2160
- regulator_disable (trf -> regulator );
2163
+ regulator_disable (trf -> vddio_regulator );
2164
+ regulator_disable (trf -> vin_regulator );
2161
2165
2162
2166
mutex_destroy (& trf -> lock );
2163
2167
}
0 commit comments