* [PATCH] wl12xx: add chip_family to platform data struct
@ 2011-11-08 14:43 Luciano Coelho
2011-12-01 10:08 ` Luciano Coelho
0 siblings, 1 reply; 2+ messages in thread
From: Luciano Coelho @ 2011-11-08 14:43 UTC (permalink / raw)
To: coelho; +Cc: linux-wireless
To abstract the bus modules from the actual driver that handles the
chip, we can pass the chip_family struct in the platform data. This
string is used by the bus modules to name the platform device they
create. The same string is used by the platform driver to get probed.
If not specified, we use "wl12xx" as default for backwards
compatibility.
Signed-off-by: Luciano Coelho <coelho@ti.com>
---
drivers/net/wireless/wl12xx/sdio.c | 6 +++++-
drivers/net/wireless/wl12xx/spi.c | 6 +++++-
drivers/net/wireless/wl12xx/wl12xx.h | 2 ++
include/linux/wl12xx.h | 3 +++
4 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/wl12xx/sdio.c b/drivers/net/wireless/wl12xx/sdio.c
index 468a505..e266a20 100644
--- a/drivers/net/wireless/wl12xx/sdio.c
+++ b/drivers/net/wireless/wl12xx/sdio.c
@@ -226,7 +226,11 @@ static int __devinit wl1271_probe(struct sdio_func *func,
/* Tell PM core that we don't need the card to be powered now */
pm_runtime_put_noidle(&func->dev);
- glue->core = platform_device_alloc("wl12xx", -1);
+ /* get the chip family from pdata, if not available use default */
+ glue->core = platform_device_alloc(wlan_data->chip_family?
+ wlan_data->chip_family:
+ DEFAULT_CHIP_FAMILY,
+ -1);
if (!glue->core) {
dev_err(glue->dev, "can't allocate platform_device");
ret = -ENOMEM;
diff --git a/drivers/net/wireless/wl12xx/spi.c b/drivers/net/wireless/wl12xx/spi.c
index 9e6f7fa..6a83d9e 100644
--- a/drivers/net/wireless/wl12xx/spi.c
+++ b/drivers/net/wireless/wl12xx/spi.c
@@ -351,7 +351,11 @@ static int __devinit wl1271_probe(struct spi_device *spi)
goto out_free_glue;
}
- glue->core = platform_device_alloc("wl12xx", -1);
+ /* get the chip family from pdata, if not available use default */
+ glue->core = platform_device_alloc(wlan_data->chip_family?
+ wlan_data->chip_family:
+ DEFAULT_CHIP_FAMILY,
+ -1);
if (!glue->core) {
dev_err(glue->dev, "can't allocate platform_device\n");
ret = -ENOMEM;
diff --git a/drivers/net/wireless/wl12xx/wl12xx.h b/drivers/net/wireless/wl12xx/wl12xx.h
index e58e801..2f35960 100644
--- a/drivers/net/wireless/wl12xx/wl12xx.h
+++ b/drivers/net/wireless/wl12xx/wl12xx.h
@@ -45,6 +45,8 @@
#define WL127X_FW_NAME "ti-connectivity/wl127x-fw-3.bin"
#define WL128X_FW_NAME "ti-connectivity/wl128x-fw-3.bin"
+#define DEFAULT_CHIP_FAMILY "wl12xx"
+
/*
* wl127x and wl128x are using the same NVS file name. However, the
* ini parameters between them are different. The driver validates
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index 0d63731..adea8f8 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -53,6 +53,9 @@ struct wl12xx_platform_data {
bool use_eeprom;
int board_ref_clock;
int board_tcxo_clock;
+ const char *chip_family;
+
+ /* internal use */
unsigned long platform_quirks;
bool pwr_in_suspend;
--
1.7.4.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] wl12xx: add chip_family to platform data struct
2011-11-08 14:43 [PATCH] wl12xx: add chip_family to platform data struct Luciano Coelho
@ 2011-12-01 10:08 ` Luciano Coelho
0 siblings, 0 replies; 2+ messages in thread
From: Luciano Coelho @ 2011-12-01 10:08 UTC (permalink / raw)
To: linux-wireless; +Cc: arik
On Tue, 2011-11-08 at 16:43 +0200, Luciano Coelho wrote:
> To abstract the bus modules from the actual driver that handles the
> chip, we can pass the chip_family struct in the platform data. This
> string is used by the bus modules to name the platform device they
> create. The same string is used by the platform driver to get probed.
>
> If not specified, we use "wl12xx" as default for backwards
> compatibility.
>
> Signed-off-by: Luciano Coelho <coelho@ti.com>
> ---
I'll skip this patch for now, as it needs to be reworked for backwards
compatibility with compat-wireless. We have a solution that I'll
implement soon (thanks Arik for the good discussions!).
And once we touch the platform data again, we need to add some version
numbering, so we don't keep breaking the ABI between the board files and
the driver. More details to follow. ;)
--
Cheers,
Luca.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-01 10:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-08 14:43 [PATCH] wl12xx: add chip_family to platform data struct Luciano Coelho
2011-12-01 10:08 ` Luciano Coelho
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox