At the moment the atomisp has duplicate code for parsing Intel camera sensor GPIOS and calling the special 79234640-9e10-4fea-a5c1-b5aa8b19756f _DSM to get the GPIO type and map it to the sensor. Export int3472_discrete_parse_crs() so that the atomisp driver can reuse the INT3472 code for this.
Unified · Split
| @@ -363,7 +363,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares, · 362 unmodified lines | |||
| 363 | return 1; | 363 | return 1; |
| 364 | } | 364 | } |
| 365 | 365 | ||
| 366 | static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472) | 366 | int int3472_discrete_parse_crs(struct int3472_discrete_device *int3472) |
| 367 | { | 367 | { |
| 368 | LIST_HEAD(resource_list); | 368 | LIST_HEAD(resource_list); |
| 369 | int ret; | 369 | int ret; |
| @@ -388,17 +388,22 @@ static int skl_int3472_parse_crs(struct int3472_discrete_device *int3472) · 18 unmodified lines | |||
| 388 | 388 | ||
| 389 | return 0; | 389 | return 0; |
| 390 | } | 390 | } |
| 391 | EXPORT_SYMBOL_NS_GPL(int3472_discrete_parse_crs, "INTEL_INT3472_DISCRETE"); | ||
| 391 | 392 | ||
| 392 | static void skl_int3472_discrete_remove(struct platform_device *pdev) | 393 | void int3472_discrete_cleanup(struct int3472_discrete_device *int3472) |
| 393 | { | 394 | { |
| 394 | struct int3472_discrete_device *int3472 = platform_get_drvdata(pdev); | ||
| 395 | |||
| 396 | gpiod_remove_lookup_table(&int3472->gpios); | 395 | gpiod_remove_lookup_table(&int3472->gpios); |
| 397 | 396 | ||
| 398 | skl_int3472_unregister_clock(int3472); | 397 | skl_int3472_unregister_clock(int3472); |
| 399 | skl_int3472_unregister_pled(int3472); | 398 | skl_int3472_unregister_pled(int3472); |
| 400 | skl_int3472_unregister_regulator(int3472); | 399 | skl_int3472_unregister_regulator(int3472); |
| 401 | } | 400 | } |
| 401 | EXPORT_SYMBOL_NS_GPL(int3472_discrete_cleanup, "INTEL_INT3472_DISCRETE"); | ||
| 402 | |||
| 403 | static void skl_int3472_discrete_remove(struct platform_device *pdev) | ||
| 404 | { | ||
| 405 | int3472_discrete_cleanup(platform_get_drvdata(pdev)); | ||
| 406 | } | ||
| 402 | 407 | ||
| 403 | static int skl_int3472_discrete_probe(struct platform_device *pdev) | 408 | static int skl_int3472_discrete_probe(struct platform_device *pdev) |
| 404 | { | 409 | { |
| @@ -453,7 +458,7 @@ static int skl_int3472_discrete_probe(struct platform_device *pdev) · 48 unmodified lines | |||
| 453 | */ | 458 | */ |
| 454 | INIT_LIST_HEAD(&int3472->gpios.list); | 459 | INIT_LIST_HEAD(&int3472->gpios.list); |
| 455 | 460 | ||
| 456 | ret = skl_int3472_parse_crs(int3472); | 461 | ret = int3472_discrete_parse_crs(int3472); |
| 457 | if (ret) { | 462 | if (ret) { |
| 458 | skl_int3472_discrete_remove(pdev); | 463 | skl_int3472_discrete_remove(pdev); |
| 459 | return ret; | 464 | return ret; |
| @@ -147,6 +147,9 @@ int skl_int3472_get_sensor_adev_and_name(struct device *dev, · 146 unmodified lines | |||
| 147 | struct acpi_device **sensor_adev_ret, | 147 | struct acpi_device **sensor_adev_ret, |
| 148 | const char **name_ret); | 148 | const char **name_ret); |
| 149 | 149 | ||
| 150 | int int3472_discrete_parse_crs(struct int3472_discrete_device *int3472); | ||
| 151 | void int3472_discrete_cleanup(struct int3472_discrete_device *int3472); | ||
| 152 | |||
| 150 | int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472, | 153 | int skl_int3472_register_gpio_clock(struct int3472_discrete_device *int3472, |
| 151 | struct gpio_desc *gpio); | 154 | struct gpio_desc *gpio); |
| 152 | int skl_int3472_register_dsm_clock(struct int3472_discrete_device *int3472); | 155 | int skl_int3472_register_dsm_clock(struct int3472_discrete_device *int3472); |