Dne Út 21. července 2009 17:16:07 Takashi Iwai napsal(a): > At Tue, 21 Jul 2009 15:53:23 +0100, > > Mark Brown wrote: > > On Tue, Jul 21, 2009 at 04:50:26PM +0200, Takashi Iwai wrote: > > > Marek Vasut wrote: > > > > int ret; > > > > + pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; > > > > > > Use the get function. > > > > There's no such function in mainline right now. However, apropos of > > something else I submitted a patch adding that to the driver core - it's > > been merged for 2.6.32 but won't be available in ALSA until after the > > next merge window. The function is dev_get_platdata(). > > Ah, right. This can be fixed later, then. > > > > Also, at the next time, add Russell or linux-arm to Cc so that he > > > knows at least that a file in arch/arm will be changed. > > > > Ideally split things into two separate patches. > > Agreed. > > > Takashi Also, another patch (depends on previous two). This one converts wm97xx driver to use supplied platform_data. This will have a follow-up patch that converts all the platforms to supply the platform_data properly.
From 833cb3050e05bc1a2ed3445533d5fe44188364e7 Mon Sep 17 00:00:00 2001 From: Marek Vasut <marek.vasut@xxxxxxxxx> Date: Tue, 21 Jul 2009 18:52:28 +0200 Subject: [PATCH 1/2] Convert WM97xx driver to use platform_data This patch converts the wm97xx driver to use platform_data supplied by ac97 bus. Also, this fixes the related wm97xx-battery driver to use it's platform_data and prepares a structure for touchscreen driver. Signed-off-by: Marek Vasut <marek.vasut@xxxxxxxxx> --- drivers/input/touchscreen/wm97xx-core.c | 3 +++ drivers/power/wm97xx_battery.c | 13 ++++--------- include/linux/wm97xx.h | 30 ++++++++++++++++++++++++++++++ include/linux/wm97xx_batt.h | 26 -------------------------- 4 files changed, 37 insertions(+), 35 deletions(-) delete mode 100644 include/linux/wm97xx_batt.h diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c index 252eb11..e379479 100644 --- a/drivers/input/touchscreen/wm97xx-core.c +++ b/drivers/input/touchscreen/wm97xx-core.c @@ -561,6 +561,7 @@ static void wm97xx_ts_input_close(struct input_dev *idev) static int wm97xx_probe(struct device *dev) { struct wm97xx *wm; + struct wm97xx_pdata *pdata = dev->platform_data; int ret = 0, id = 0; wm = kzalloc(sizeof(struct wm97xx), GFP_KERNEL); @@ -658,6 +659,7 @@ static int wm97xx_probe(struct device *dev) } platform_set_drvdata(wm->battery_dev, wm); wm->battery_dev->dev.parent = dev; + wm->battery_dev->dev.platform_data = pdata->batt_pdata; ret = platform_device_add(wm->battery_dev); if (ret < 0) goto batt_reg_err; @@ -671,6 +673,7 @@ static int wm97xx_probe(struct device *dev) } platform_set_drvdata(wm->touch_dev, wm); wm->touch_dev->dev.parent = dev; + wm->touch_dev->dev.platform_data = pdata->touch_pdata; ret = platform_device_add(wm->touch_dev); if (ret < 0) goto touch_reg_err; diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c index 8bde921..66af868 100644 --- a/drivers/power/wm97xx_battery.c +++ b/drivers/power/wm97xx_battery.c @@ -22,13 +22,12 @@ #include <linux/spinlock.h> #include <linux/interrupt.h> #include <linux/gpio.h> -#include <linux/wm97xx_batt.h> static DEFINE_MUTEX(bat_lock); static struct work_struct bat_work; struct mutex work_lock; static int bat_status = POWER_SUPPLY_STATUS_UNKNOWN; -static struct wm97xx_batt_info *pdata; +static struct wm97xx_batt_pdata *pdata; static enum power_supply_property *prop; static unsigned long wm97xx_read_bat(struct power_supply *bat_ps) @@ -150,13 +149,15 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev) int props = 1; /* POWER_SUPPLY_PROP_PRESENT */ int i = 0; + pdata = dev->dev.platform_data; + if (dev->id != -1) return -EINVAL; mutex_init(&work_lock); if (!pdata) { - dev_err(&dev->dev, "Please use wm97xx_bat_set_pdata\n"); + dev_err(&dev->dev, "No platform_data supplied\n"); return -EINVAL; } @@ -258,12 +259,6 @@ static void __exit wm97xx_bat_exit(void) platform_driver_unregister(&wm97xx_bat_driver); } -void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) -{ - pdata = data; -} -EXPORT_SYMBOL_GPL(wm97xx_bat_set_pdata); - module_init(wm97xx_bat_init); module_exit(wm97xx_bat_exit); diff --git a/include/linux/wm97xx.h b/include/linux/wm97xx.h index 0c98781..746edfa 100644 --- a/include/linux/wm97xx.h +++ b/include/linux/wm97xx.h @@ -293,6 +293,36 @@ struct wm97xx { u16 suspend_mode; /* PRP in suspend mode */ }; +struct wm97xx_batt_pdata { + int batt_aux; + int temp_aux; + int charge_gpio; + int min_voltage; + int max_voltage; + int batt_div; + int batt_mult; + int temp_div; + int temp_mult; + int batt_tech; + char *batt_name; +}; + +struct wm97xx_touch_pdata { + int irq; + bool irq_inverted; + + int cont_rate; + int pen_int; + int pressure; + int ac97_touch_slot; + +}; + +struct wm97xx_pdata { + struct wm97xx_batt_pdata *batt_pdata; /* battery data */ + struct wm97xx_touch_pdata *touch_pdata; +}; + /* * Codec GPIO access (not supported on WM9705) * This can be used to set/get codec GPIO and Virtual GPIO status. diff --git a/include/linux/wm97xx_batt.h b/include/linux/wm97xx_batt.h deleted file mode 100644 index 9681d1a..0000000 --- a/include/linux/wm97xx_batt.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _LINUX_WM97XX_BAT_H -#define _LINUX_WM97XX_BAT_H - -#include <linux/wm97xx.h> - -struct wm97xx_batt_info { - int batt_aux; - int temp_aux; - int charge_gpio; - int min_voltage; - int max_voltage; - int batt_div; - int batt_mult; - int temp_div; - int temp_mult; - int batt_tech; - char *batt_name; -}; - -#ifdef CONFIG_BATTERY_WM97XX -void __init wm97xx_bat_set_pdata(struct wm97xx_batt_info *data); -#else -static inline void wm97xx_bat_set_pdata(struct wm97xx_batt_info *data) {} -#endif - -#endif -- 1.6.3.3
_______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel