@@ -402,8 +402,8 @@ static void cs_assert(struct driver_data *drv_data)
402
402
return ;
403
403
}
404
404
405
- if (gpio_is_valid ( chip -> gpio_cs ) ) {
406
- gpio_set_value (chip -> gpio_cs , chip -> gpio_cs_inverted );
405
+ if (chip -> gpiod_cs ) {
406
+ gpiod_set_value (chip -> gpiod_cs , chip -> gpio_cs_inverted );
407
407
return ;
408
408
}
409
409
@@ -424,8 +424,8 @@ static void cs_deassert(struct driver_data *drv_data)
424
424
return ;
425
425
}
426
426
427
- if (gpio_is_valid ( chip -> gpio_cs ) ) {
428
- gpio_set_value (chip -> gpio_cs , !chip -> gpio_cs_inverted );
427
+ if (chip -> gpiod_cs ) {
428
+ gpiod_set_value (chip -> gpiod_cs , !chip -> gpio_cs_inverted );
429
429
return ;
430
430
}
431
431
@@ -1213,17 +1213,16 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip,
1213
1213
struct pxa2xx_spi_chip * chip_info )
1214
1214
{
1215
1215
struct driver_data * drv_data = spi_master_get_devdata (spi -> master );
1216
+ struct gpio_desc * gpiod ;
1216
1217
int err = 0 ;
1217
1218
1218
1219
if (chip == NULL )
1219
1220
return 0 ;
1220
1221
1221
1222
if (drv_data -> cs_gpiods ) {
1222
- struct gpio_desc * gpiod ;
1223
-
1224
1223
gpiod = drv_data -> cs_gpiods [spi -> chip_select ];
1225
1224
if (gpiod ) {
1226
- chip -> gpio_cs = desc_to_gpio ( gpiod ) ;
1225
+ chip -> gpiod_cs = gpiod ;
1227
1226
chip -> gpio_cs_inverted = spi -> mode & SPI_CS_HIGH ;
1228
1227
gpiod_set_value (gpiod , chip -> gpio_cs_inverted );
1229
1228
}
@@ -1237,8 +1236,10 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip,
1237
1236
/* NOTE: setup() can be called multiple times, possibly with
1238
1237
* different chip_info, release previously requested GPIO
1239
1238
*/
1240
- if (gpio_is_valid (chip -> gpio_cs ))
1241
- gpio_free (chip -> gpio_cs );
1239
+ if (chip -> gpiod_cs ) {
1240
+ gpio_free (desc_to_gpio (chip -> gpiod_cs ));
1241
+ chip -> gpiod_cs = NULL ;
1242
+ }
1242
1243
1243
1244
/* If (*cs_control) is provided, ignore GPIO chip select */
1244
1245
if (chip_info -> cs_control ) {
@@ -1254,11 +1255,11 @@ static int setup_cs(struct spi_device *spi, struct chip_data *chip,
1254
1255
return err ;
1255
1256
}
1256
1257
1257
- chip -> gpio_cs = chip_info -> gpio_cs ;
1258
+ gpiod = gpio_to_desc (chip_info -> gpio_cs );
1259
+ chip -> gpiod_cs = gpiod ;
1258
1260
chip -> gpio_cs_inverted = spi -> mode & SPI_CS_HIGH ;
1259
1261
1260
- err = gpio_direction_output (chip -> gpio_cs ,
1261
- !chip -> gpio_cs_inverted );
1262
+ err = gpiod_direction_output (gpiod , !chip -> gpio_cs_inverted );
1262
1263
}
1263
1264
1264
1265
return err ;
@@ -1317,8 +1318,7 @@ static int setup(struct spi_device *spi)
1317
1318
}
1318
1319
1319
1320
chip -> frm = spi -> chip_select ;
1320
- } else
1321
- chip -> gpio_cs = -1 ;
1321
+ }
1322
1322
chip -> enable_dma = drv_data -> master_info -> enable_dma ;
1323
1323
chip -> timeout = TIMOUT_DFLT ;
1324
1324
}
@@ -1416,8 +1416,8 @@ static void cleanup(struct spi_device *spi)
1416
1416
return ;
1417
1417
1418
1418
if (drv_data -> ssp_type != CE4100_SSP && !drv_data -> cs_gpiods &&
1419
- gpio_is_valid ( chip -> gpio_cs ) )
1420
- gpio_free (chip -> gpio_cs );
1419
+ chip -> gpiod_cs )
1420
+ gpio_free (desc_to_gpio ( chip -> gpiod_cs ) );
1421
1421
1422
1422
kfree (chip );
1423
1423
}
0 commit comments