wcnss: Proxy vote for Iris regulators on behalf of Riva

This patch includes the following changes,
a. Proxy vote for Iris regulators on behalf of Riva.
b. During SSR power-on, vote for Iris regulators just like in
   cold boot.
c. Remove wcnss_riva.h, it was meant to be local to platform driver.
d. Make WCNSS platform driver part of kernel

Change-Id: Ied1f91297305469a0e4d9e524a03b49e1f600852
Signed-off-by: Sameer Thalappil <sameert@codeaurora.org>
This commit is contained in:
Sameer Thalappil
2011-12-07 10:53:31 -08:00
parent fdeb4932f8
commit 409ed358cf
6 changed files with 55 additions and 37 deletions

View File

@@ -235,7 +235,7 @@ CONFIG_SMSC911X=y
CONFIG_KS8851=m CONFIG_KS8851=m
# CONFIG_NETDEV_1000 is not set # CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set # CONFIG_NETDEV_10000 is not set
CONFIG_WCNSS_CORE=m CONFIG_WCNSS_CORE=y
CONFIG_USB_USBNET=y CONFIG_USB_USBNET=y
CONFIG_SLIP=y CONFIG_SLIP=y
CONFIG_SLIP_COMPRESSED=y CONFIG_SLIP_COMPRESSED=y

View File

@@ -17,6 +17,8 @@
#include <linux/io.h> #include <linux/io.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/wcnss_wlan.h>
#include <mach/irqs.h> #include <mach/irqs.h>
#include <mach/scm.h> #include <mach/scm.h>
#include <mach/subsystem_restart.h> #include <mach/subsystem_restart.h>
@@ -79,14 +81,32 @@ static void smsm_riva_reset(void)
/* Subsystem handlers */ /* Subsystem handlers */
static int riva_shutdown(const struct subsys_data *subsys) static int riva_shutdown(const struct subsys_data *subsys)
{ {
struct platform_device *pdev = wcnss_get_platform_device();
struct wcnss_wlan_config *pwlanconfig = wcnss_get_wlan_config();
int ret = -1;
pil_force_shutdown("wcnss"); pil_force_shutdown("wcnss");
return 0;
/* proxy vote on behalf of Riva */
if (pdev && pwlanconfig)
ret = wcnss_wlan_power(&pdev->dev, pwlanconfig,
WCNSS_WLAN_SWITCH_OFF);
return ret;
} }
static int riva_powerup(const struct subsys_data *subsys) static int riva_powerup(const struct subsys_data *subsys)
{ {
pil_force_boot("wcnss"); struct platform_device *pdev = wcnss_get_platform_device();
return 0; struct wcnss_wlan_config *pwlanconfig = wcnss_get_wlan_config();
int ret = -1;
if (pdev && pwlanconfig)
ret = wcnss_wlan_power(&pdev->dev, pwlanconfig,
WCNSS_WLAN_SWITCH_ON);
if (!ret)
pil_force_boot("wcnss");
return ret;
} }
/* RAM segments for Riva SS; /* RAM segments for Riva SS;

View File

@@ -18,10 +18,10 @@
#include <linux/regulator/consumer.h> #include <linux/regulator/consumer.h>
#include <linux/mfd/pm8xxx/pm8921.h> #include <linux/mfd/pm8xxx/pm8921.h>
#include <linux/mfd/pm8xxx/gpio.h> #include <linux/mfd/pm8xxx/gpio.h>
#include <linux/wcnss_wlan.h>
#include <mach/msm_xo.h> #include <mach/msm_xo.h>
#include <mach/msm_iomap.h> #include <mach/msm_iomap.h>
#include "wcnss_riva.h"
static void __iomem *msm_riva_base; static void __iomem *msm_riva_base;
static struct msm_xo_voter *wlan_clock; static struct msm_xo_voter *wlan_clock;

View File

@@ -1,31 +0,0 @@
/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
* only version 2 as published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/
#ifndef _WCNSS_RIVA_H_
#define _WCNSS_RIVA_H_
#include <linux/device.h>
enum wcnss_opcode {
WCNSS_WLAN_SWITCH_OFF = 0,
WCNSS_WLAN_SWITCH_ON,
};
struct wcnss_wlan_config {
int use_48mhz_xo;
};
int wcnss_wlan_power(struct device *dev,
struct wcnss_wlan_config *cfg,
enum wcnss_opcode opcode);
#endif /* _WCNSS_RIVA_H_ */

View File

@@ -22,7 +22,6 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/gpio.h> #include <linux/gpio.h>
#include <mach/peripheral-loader.h> #include <mach/peripheral-loader.h>
#include "wcnss_riva.h"
#define DEVICE "wcnss_wlan" #define DEVICE "wcnss_wlan"
#define VERSION "1.01" #define VERSION "1.01"
@@ -128,6 +127,22 @@ struct device *wcnss_wlan_get_device(void)
} }
EXPORT_SYMBOL(wcnss_wlan_get_device); EXPORT_SYMBOL(wcnss_wlan_get_device);
struct platform_device *wcnss_get_platform_device(void)
{
if (penv && penv->pdev)
return penv->pdev;
return NULL;
}
EXPORT_SYMBOL(wcnss_get_platform_device);
struct wcnss_wlan_config *wcnss_get_wlan_config(void)
{
if (penv && penv->pdev)
return &penv->wlan_config;
return NULL;
}
EXPORT_SYMBOL(wcnss_get_wlan_config);
struct resource *wcnss_wlan_get_memory_map(struct device *dev) struct resource *wcnss_wlan_get_memory_map(struct device *dev)
{ {
if (penv && dev && (dev == &penv->pdev->dev) && penv->smd_channel_ready) if (penv && dev && (dev == &penv->pdev->dev) && penv->smd_channel_ready)

View File

@@ -16,6 +16,15 @@
#include <linux/device.h> #include <linux/device.h>
enum wcnss_opcode {
WCNSS_WLAN_SWITCH_OFF = 0,
WCNSS_WLAN_SWITCH_ON,
};
struct wcnss_wlan_config {
int use_48mhz_xo;
};
#define WCNSS_WLAN_IRQ_INVALID -1 #define WCNSS_WLAN_IRQ_INVALID -1
struct device *wcnss_wlan_get_device(void); struct device *wcnss_wlan_get_device(void);
@@ -26,6 +35,11 @@ void wcnss_wlan_register_pm_ops(struct device *dev,
const struct dev_pm_ops *pm_ops); const struct dev_pm_ops *pm_ops);
void wcnss_wlan_unregister_pm_ops(struct device *dev, void wcnss_wlan_unregister_pm_ops(struct device *dev,
const struct dev_pm_ops *pm_ops); const struct dev_pm_ops *pm_ops);
struct platform_device *wcnss_get_platform_device(void);
struct wcnss_wlan_config *wcnss_get_wlan_config(void);
int wcnss_wlan_power(struct device *dev,
struct wcnss_wlan_config *cfg,
enum wcnss_opcode opcode);
#define wcnss_wlan_get_drvdata(dev) dev_get_drvdata(dev) #define wcnss_wlan_get_drvdata(dev) dev_get_drvdata(dev)
#define wcnss_wlan_set_drvdata(dev, data) dev_set_drvdata((dev), (data)) #define wcnss_wlan_set_drvdata(dev, data) dev_set_drvdata((dev), (data))