Search Linux Wireless

Re: wlcore-spi crash

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Charles,

On Thu, 2014-01-30 at 17:20 -0500, Charles wrote:
> So my hack was obviously not the right solution, because I'm not
> powering the chip.  I know that in wlcore\spi.c, I need to set a
> .power function in spi_ops (i.e. .power = wl12xx_spi_power).  And I
> already have a wl12xx_platform_data with a .set_power function defined
> in my board platform file.  But I don't know how to access my platform
> file's set_power function from the wl12xx_spi_power function in spi.c.
> 
> In other words, I can' figure out how to do this from wlcore\spi.c:
> 
> static int wl12xx_spi_power(struct device *child, bool enable) {
> 
>     set_power_function_defined_in_my_board_platform_file(enable);
> 
> }

Try this:


diff --git a/drivers/net/wireless/ti/wlcore/spi.c b/drivers/net/wireless/ti/wlcore/spi.c
index b2c018d..1278583 100644
--- a/drivers/net/wireless/ti/wlcore/spi.c
+++ b/drivers/net/wireless/ti/wlcore/spi.c
@@ -316,6 +316,16 @@ static int __must_check wl12xx_spi_raw_write(struct device *child, int addr,
        return 0;
 }
 
+static int wl12xx_spi_power(struct device *child, bool enable)
+{
+       struct wl12xx_spi_glue *glue = dev_get_drvdata(child->parent);
+       struct wlcore_platdev_data *pdev_data = glue->core->dev.platform_data;
+
+       pdev_data->pdata->set_power(enable);
+
+       return 0;
+}
+
 static struct wl1271_if_operations spi_ops = {
        .read           = wl12xx_spi_raw_read,
        .write          = wl12xx_spi_raw_write,

Note that this is only compile-tested, so I have no clue if it really
works.

I'm *not* saying this is the right way to do it, I just hacked it up
quickly.

I hope this helps you go in the right direction.

--
Luca.

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux