Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: wm97xx: add new AC97 bus support

This adds support for the new AC97 bus code, which discovers the devices
rather than uses platform data.

As part of this discovery, it enables a multi-function device wm97xx,
which supports touchscreen, battery, ADC and an audio codec. This patch
adds the code to bind the touchscreen "cell" as the touchscreen driver.

This was tested on the pxa architecture with a pxa270 + wm9713 + the
mioa701 touchscreen.

Signed-off-by: Robert Jarzmik <robert.jarzmik@free.fr>
Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Robert Jarzmik and committed by
Mark Brown
ae9d1b5f a5c6951c

+56 -2
+1 -1
drivers/input/touchscreen/Kconfig
··· 727 727 728 728 config TOUCHSCREEN_WM97XX 729 729 tristate "Support for WM97xx AC97 touchscreen controllers" 730 - depends on AC97_BUS 730 + depends on AC97_BUS || AC97_BUS_NEW 731 731 help 732 732 Say Y here if you have a Wolfson Microelectronics WM97xx 733 733 touchscreen connected to your system. Note that this option
+55 -1
drivers/input/touchscreen/wm97xx-core.c
··· 44 44 #include <linux/pm.h> 45 45 #include <linux/interrupt.h> 46 46 #include <linux/bitops.h> 47 + #include <linux/mfd/wm97xx.h> 47 48 #include <linux/workqueue.h> 48 49 #include <linux/wm97xx.h> 49 50 #include <linux/uaccess.h> ··· 767 766 return 0; 768 767 } 769 768 769 + static int wm97xx_mfd_probe(struct platform_device *pdev) 770 + { 771 + struct wm97xx *wm; 772 + struct wm97xx_platform_data *mfd_pdata = dev_get_platdata(&pdev->dev); 773 + int ret; 774 + 775 + wm = devm_kzalloc(&pdev->dev, sizeof(struct wm97xx), GFP_KERNEL); 776 + if (!wm) 777 + return -ENOMEM; 778 + 779 + wm->dev = &pdev->dev; 780 + wm->ac97 = mfd_pdata->ac97; 781 + 782 + ret = _wm97xx_probe(wm); 783 + if (ret) 784 + return ret; 785 + 786 + ret = wm97xx_add_battery(wm, mfd_pdata->batt_pdata); 787 + if (ret < 0) 788 + goto batt_err; 789 + 790 + return ret; 791 + 792 + batt_err: 793 + wm97xx_unregister_touch(wm); 794 + return ret; 795 + } 796 + 797 + static int wm97xx_mfd_remove(struct platform_device *pdev) 798 + { 799 + return wm97xx_remove(&pdev->dev); 800 + } 801 + 770 802 static int __maybe_unused wm97xx_suspend(struct device *dev) 771 803 { 772 804 struct wm97xx *wm = dev_get_drvdata(dev); ··· 896 862 897 863 static struct device_driver wm97xx_driver = { 898 864 .name = "wm97xx-ts", 865 + #ifdef CONFIG_AC97_BUS 899 866 .bus = &ac97_bus_type, 867 + #endif 900 868 .owner = THIS_MODULE, 901 869 .probe = wm97xx_probe, 902 870 .remove = wm97xx_remove, 903 871 .pm = &wm97xx_pm_ops, 904 872 }; 905 873 874 + static struct platform_driver wm97xx_mfd_driver = { 875 + .driver = { 876 + .name = "wm97xx-ts", 877 + .pm = &wm97xx_pm_ops, 878 + }, 879 + .probe = wm97xx_mfd_probe, 880 + .remove = wm97xx_mfd_remove, 881 + }; 882 + 906 883 static int __init wm97xx_init(void) 907 884 { 908 - return driver_register(&wm97xx_driver); 885 + int ret; 886 + 887 + ret = platform_driver_register(&wm97xx_mfd_driver); 888 + if (ret) 889 + return ret; 890 + 891 + if (IS_BUILTIN(CONFIG_AC97_BUS)) 892 + ret = driver_register(&wm97xx_driver); 893 + return ret; 909 894 } 910 895 911 896 static void __exit wm97xx_exit(void) 912 897 { 913 898 driver_unregister(&wm97xx_driver); 899 + platform_driver_unregister(&wm97xx_mfd_driver); 914 900 } 915 901 916 902 module_init(wm97xx_init);