| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Driver for the Diolan DLN-2 USB adapter |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Derived from: |
|---|
| 7 | 8 | * i2c-diolan-u2c.c |
|---|
| 8 | 9 | * Copyright (c) 2010-2011 Ericsson AB |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or |
|---|
| 11 | | - * modify it under the terms of the GNU General Public License as |
|---|
| 12 | | - * published by the Free Software Foundation, version 2. |
|---|
| 13 | 10 | */ |
|---|
| 14 | 11 | |
|---|
| 15 | 12 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 53 | 50 | DLN2_HANDLE_GPIO, |
|---|
| 54 | 51 | DLN2_HANDLE_I2C, |
|---|
| 55 | 52 | DLN2_HANDLE_SPI, |
|---|
| 53 | + DLN2_HANDLE_ADC, |
|---|
| 56 | 54 | DLN2_HANDLES |
|---|
| 57 | 55 | }; |
|---|
| 58 | 56 | |
|---|
| .. | .. |
|---|
| 652 | 650 | return 0; |
|---|
| 653 | 651 | } |
|---|
| 654 | 652 | |
|---|
| 653 | +enum { |
|---|
| 654 | + DLN2_ACPI_MATCH_GPIO = 0, |
|---|
| 655 | + DLN2_ACPI_MATCH_I2C = 1, |
|---|
| 656 | + DLN2_ACPI_MATCH_SPI = 2, |
|---|
| 657 | + DLN2_ACPI_MATCH_ADC = 3, |
|---|
| 658 | +}; |
|---|
| 659 | + |
|---|
| 655 | 660 | static struct dln2_platform_data dln2_pdata_gpio = { |
|---|
| 656 | 661 | .handle = DLN2_HANDLE_GPIO, |
|---|
| 662 | +}; |
|---|
| 663 | + |
|---|
| 664 | +static struct mfd_cell_acpi_match dln2_acpi_match_gpio = { |
|---|
| 665 | + .adr = DLN2_ACPI_MATCH_GPIO, |
|---|
| 657 | 666 | }; |
|---|
| 658 | 667 | |
|---|
| 659 | 668 | /* Only one I2C port seems to be supported on current hardware */ |
|---|
| .. | .. |
|---|
| 662 | 671 | .port = 0, |
|---|
| 663 | 672 | }; |
|---|
| 664 | 673 | |
|---|
| 674 | +static struct mfd_cell_acpi_match dln2_acpi_match_i2c = { |
|---|
| 675 | + .adr = DLN2_ACPI_MATCH_I2C, |
|---|
| 676 | +}; |
|---|
| 677 | + |
|---|
| 665 | 678 | /* Only one SPI port supported */ |
|---|
| 666 | 679 | static struct dln2_platform_data dln2_pdata_spi = { |
|---|
| 667 | 680 | .handle = DLN2_HANDLE_SPI, |
|---|
| 668 | 681 | .port = 0, |
|---|
| 669 | 682 | }; |
|---|
| 670 | 683 | |
|---|
| 684 | +static struct mfd_cell_acpi_match dln2_acpi_match_spi = { |
|---|
| 685 | + .adr = DLN2_ACPI_MATCH_SPI, |
|---|
| 686 | +}; |
|---|
| 687 | + |
|---|
| 688 | +/* Only one ADC port supported */ |
|---|
| 689 | +static struct dln2_platform_data dln2_pdata_adc = { |
|---|
| 690 | + .handle = DLN2_HANDLE_ADC, |
|---|
| 691 | + .port = 0, |
|---|
| 692 | +}; |
|---|
| 693 | + |
|---|
| 694 | +static struct mfd_cell_acpi_match dln2_acpi_match_adc = { |
|---|
| 695 | + .adr = DLN2_ACPI_MATCH_ADC, |
|---|
| 696 | +}; |
|---|
| 697 | + |
|---|
| 671 | 698 | static const struct mfd_cell dln2_devs[] = { |
|---|
| 672 | 699 | { |
|---|
| 673 | 700 | .name = "dln2-gpio", |
|---|
| 701 | + .acpi_match = &dln2_acpi_match_gpio, |
|---|
| 674 | 702 | .platform_data = &dln2_pdata_gpio, |
|---|
| 675 | 703 | .pdata_size = sizeof(struct dln2_platform_data), |
|---|
| 676 | 704 | }, |
|---|
| 677 | 705 | { |
|---|
| 678 | 706 | .name = "dln2-i2c", |
|---|
| 707 | + .acpi_match = &dln2_acpi_match_i2c, |
|---|
| 679 | 708 | .platform_data = &dln2_pdata_i2c, |
|---|
| 680 | 709 | .pdata_size = sizeof(struct dln2_platform_data), |
|---|
| 681 | 710 | }, |
|---|
| 682 | 711 | { |
|---|
| 683 | 712 | .name = "dln2-spi", |
|---|
| 713 | + .acpi_match = &dln2_acpi_match_spi, |
|---|
| 684 | 714 | .platform_data = &dln2_pdata_spi, |
|---|
| 715 | + .pdata_size = sizeof(struct dln2_platform_data), |
|---|
| 716 | + }, |
|---|
| 717 | + { |
|---|
| 718 | + .name = "dln2-adc", |
|---|
| 719 | + .acpi_match = &dln2_acpi_match_adc, |
|---|
| 720 | + .platform_data = &dln2_pdata_adc, |
|---|
| 685 | 721 | .pdata_size = sizeof(struct dln2_platform_data), |
|---|
| 686 | 722 | }, |
|---|
| 687 | 723 | }; |
|---|
| .. | .. |
|---|
| 800 | 836 | dln2_stop_rx_urbs(dln2); |
|---|
| 801 | 837 | |
|---|
| 802 | 838 | out_free: |
|---|
| 839 | + usb_put_dev(dln2->usb_dev); |
|---|
| 803 | 840 | dln2_free(dln2); |
|---|
| 804 | 841 | |
|---|
| 805 | 842 | return ret; |
|---|