mirror of
https://github.com/torvalds/linux.git
synced 2026-06-08 22:52:35 +02:00
Merge branch develop-3.10 into develop-3.10-next
This commit is contained in:
commit
040cf4804a
|
|
@ -45,7 +45,7 @@ power-led {
|
|||
compatible = "gpio-leds";
|
||||
power {
|
||||
label = "standby";
|
||||
gpios = <&gpio1 GPIO_A3 GPIO_ACTIVE_HIGH>;
|
||||
gpios = <&gpio1 GPIO_A3 GPIO_ACTIVE_LOW>;
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -24,3 +24,36 @@ &rockchip_clocks_init {
|
|||
<&clk_tsp &clk_gpll>, <&clk_nandc &clk_gpll>,
|
||||
<&clk_mac_pll &clk_cpll>;
|
||||
};
|
||||
|
||||
&i2s0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&i2s1 {
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
&rockchip_audio {
|
||||
dais {
|
||||
dai0 {
|
||||
audio-codec = <&codec>;
|
||||
i2s-controller = <&i2s0>;
|
||||
format = "i2s";
|
||||
//continuous-clock;
|
||||
//bitclock-inversion;
|
||||
//frame-inversion;
|
||||
//bitclock-master;
|
||||
//frame-master;
|
||||
};
|
||||
dai1 {
|
||||
audio-codec = <&codec>;
|
||||
i2s-controller = <&i2s0>;
|
||||
format = "i2s";
|
||||
//continuous-clock;
|
||||
//bitclock-inversion;
|
||||
//frame-inversion;
|
||||
//bitclock-master;
|
||||
//frame-master;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
@ -59,13 +59,11 @@ wireless-bluetooth {
|
|||
power-led {
|
||||
compatible = "gpio-leds";
|
||||
green {
|
||||
label = "standby";
|
||||
gpios = <&gpio0 GPIO_B0 GPIO_ACTIVE_HIGH>;
|
||||
gpios = <&gpio0 GPIO_B0 GPIO_ACTIVE_LOW>;
|
||||
default-state = "on";
|
||||
};
|
||||
red {
|
||||
label = "normal";
|
||||
gpios = <&gpio0 GPIO_D2 GPIO_ACTIVE_LOW>;
|
||||
gpios = <&gpio0 GPIO_D2 GPIO_ACTIVE_HIGH>;
|
||||
default-state = "on";
|
||||
};
|
||||
};
|
||||
|
|
|
|||
|
|
@ -967,7 +967,7 @@ codec: codec@20030000 {
|
|||
clocks = <&clk_gates5 14>;
|
||||
clock-names = "g_pclk_acodec";
|
||||
};
|
||||
rockchip-audio {
|
||||
rockchip_audio: audio-rk312x {
|
||||
compatible = "audio-rk312x";
|
||||
dais {
|
||||
dai0 {
|
||||
|
|
|
|||
|
|
@ -1032,7 +1032,7 @@ static void __sramfunc ddr_set_dll_bypass(uint32 freq)
|
|||
uint32 phase;
|
||||
if (freq < 350) {
|
||||
phase = 3;
|
||||
} else if (freq < 600) {
|
||||
} else if (freq < 666) {
|
||||
phase = 2;
|
||||
} else
|
||||
phase = 1;
|
||||
|
|
@ -1521,7 +1521,7 @@ static void __sramfunc ddr_update_odt(void)
|
|||
pPHY_Reg->PHY_REG22 = PHY_DRV_ODT_SET(PHY_RON_44ohm); /*clk drv*/
|
||||
|
||||
pPHY_Reg->PHY_REG25 = PHY_DRV_ODT_SET(PHY_RON_44ohm); /*DQS0 drv*/
|
||||
pPHY_Reg->PHY_REG36 = PHY_DRV_ODT_SET(PHY_RON_44ohm); /*DQS1 drv*/
|
||||
pPHY_Reg->PHY_REG26 = PHY_DRV_ODT_SET(PHY_RON_44ohm); /*DQS1 drv*/
|
||||
dsb();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -913,9 +913,37 @@ static struct pvtm_info rk3288v1_arm_pvtm_info = {
|
|||
.max_volt_uv = 1400000,
|
||||
};
|
||||
|
||||
static struct cpufreq_frequency_table rk3288v2_arm_pvtm_table[] = {
|
||||
{.frequency = 216000, .index = 5369},
|
||||
{.frequency = 408000, .index = 6984},
|
||||
{.frequency = 600000, .index = 8771},
|
||||
{.frequency = 816000, .index = 11434},
|
||||
{.frequency = 1008000, .index = 14178},
|
||||
{.frequency = 1200000, .index = 16797},
|
||||
{.frequency = 1416000, .index = 20178},
|
||||
{.frequency = 1608000, .index = 23303},
|
||||
{.frequency = CPUFREQ_TABLE_END, .index = 1},
|
||||
};
|
||||
|
||||
static struct pvtm_info rk3288v2_arm_pvtm_info = {
|
||||
.compatible = "rockchip,rk3288",
|
||||
.pvtm_table = rk3288v2_arm_pvtm_table,
|
||||
.channel = ARM_DVFS_CH,
|
||||
.process_version = RK3288_PROCESS_V2,
|
||||
.scan_rate_hz = 216000000,
|
||||
.sample_time_us = 1000,
|
||||
.volt_step_uv = 12500,
|
||||
.delta_pvtm_by_volt = 430,
|
||||
.delta_pvtm_by_temp = 12,
|
||||
.volt_margin_uv = 25000,
|
||||
.min_volt_uv = 900000,
|
||||
.max_volt_uv = 1400000,
|
||||
};
|
||||
|
||||
static struct pvtm_info *pvtm_info_table[] = {
|
||||
&rk3288v0_arm_pvtm_info,
|
||||
&rk3288v1_arm_pvtm_info
|
||||
&rk3288v1_arm_pvtm_info,
|
||||
&rk3288v2_arm_pvtm_info
|
||||
};
|
||||
|
||||
static int pvtm_set_single_dvfs(struct dvfs_node *dvfs_node, u32 idx,
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
|
||||
#define RK3288_PROCESS_V0 0
|
||||
#define RK3288_PROCESS_V1 1
|
||||
#define RK3288_PROCESS_V2 2
|
||||
|
||||
int rockchip_efuse_version(void);
|
||||
int rockchip_process_version(void);
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ static int __init rk3126b_ddr_init(void)
|
|||
ddr_round_rate = _ddr_round_rate;
|
||||
ddr_set_auto_self_refresh = _ddr_set_auto_self_refresh;
|
||||
ddr_bandwidth_get = _ddr_bandwidth_get;
|
||||
ddr_init(DDR3_DEFAULT, 300);
|
||||
ddr_init(DDR3_DEFAULT, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@
|
|||
#include "sram.h"
|
||||
#include "pm.h"
|
||||
#include "pm-rk312x.c"
|
||||
#include <linux/rockchip/cpu.h>
|
||||
#define RK312X_DEVICE(name) \
|
||||
{ \
|
||||
.virtual = (unsigned long) RK_##name##_VIRT, \
|
||||
|
|
@ -256,7 +257,8 @@ static int rk312x_pmu_set_power_domain(enum pmu_power_domain pd, bool on)
|
|||
rk312x_pmu_set_idle_request(IDLE_REQ_GPU, true);
|
||||
} else if (pd == PD_VIO) {
|
||||
SAVE_QOS(rga_qos, VIO_RGA);
|
||||
SAVE_QOS(ebc_qos, VIO_EBC);
|
||||
if (!soc_is_rk3126b())
|
||||
SAVE_QOS(ebc_qos, VIO_EBC);
|
||||
SAVE_QOS(iep_qos, VIO_IEP);
|
||||
SAVE_QOS(lcdc0_qos, VIO_LCDC0);
|
||||
SAVE_QOS(vip0_qos, VIO_VIP0);
|
||||
|
|
@ -276,7 +278,8 @@ static int rk312x_pmu_set_power_domain(enum pmu_power_domain pd, bool on)
|
|||
} else if (pd == PD_VIO) {
|
||||
rk312x_pmu_set_idle_request(IDLE_REQ_VIO, false);
|
||||
RESTORE_QOS(rga_qos, VIO_RGA);
|
||||
RESTORE_QOS(ebc_qos, VIO_EBC);
|
||||
if (!soc_is_rk3126b())
|
||||
RESTORE_QOS(ebc_qos, VIO_EBC);
|
||||
RESTORE_QOS(iep_qos, VIO_IEP);
|
||||
RESTORE_QOS(lcdc0_qos, VIO_LCDC0);
|
||||
RESTORE_QOS(vip0_qos, VIO_VIP0);
|
||||
|
|
@ -484,8 +487,9 @@ static int __init rk312x_ddr_init(void)
|
|||
ddr_round_rate = _ddr_round_rate;
|
||||
ddr_set_auto_self_refresh = _ddr_set_auto_self_refresh;
|
||||
ddr_bandwidth_get = _ddr_bandwidth_get;
|
||||
ddr_init(DDR3_DEFAULT, 300);
|
||||
}
|
||||
ddr_init(DDR3_DEFAULT, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
arch_initcall_sync(rk312x_ddr_init);
|
||||
|
|
|
|||
|
|
@ -671,7 +671,7 @@ static int __init rk3288_ddr_init(void)
|
|||
ddr_set_auto_self_refresh = _ddr_set_auto_self_refresh;
|
||||
ddr_bandwidth_get = _ddr_bandwidth_get;
|
||||
|
||||
ddr_init(DDR3_DEFAULT, 300);
|
||||
ddr_init(DDR3_DEFAULT, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
4
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/Kconfig
Executable file
4
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/Kconfig
Executable file
|
|
@ -0,0 +1,4 @@
|
|||
config ESP8089
|
||||
tristate "Eagle WLAN driver"
|
||||
depends on MMC && MAC80211
|
||||
|
||||
|
|
@ -10,7 +10,7 @@ $(DRIVER_NAME)-y += esp_debug.o
|
|||
$(DRIVER_NAME)-y += sdio_sif_esp.o
|
||||
$(DRIVER_NAME)-y += spi_sif_esp.o
|
||||
$(DRIVER_NAME)-y += esp_io.o
|
||||
$(DRIVER_NAME)-y += esp_android.o
|
||||
$(DRIVER_NAME)-y += esp_file.o
|
||||
$(DRIVER_NAME)-y += esp_main.o
|
||||
$(DRIVER_NAME)-y += esp_sip.o
|
||||
$(DRIVER_NAME)-y += esp_ext.o
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -1,301 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2010 - 2012 Espressif System.
|
||||
*/
|
||||
#if 0
|
||||
#define RATETAB_ENT(_rate, _rateid, _flags) { \
|
||||
.bitrate = (_rate), \
|
||||
.flags = (_flags), \
|
||||
.hw_value = (_rateid), \
|
||||
}
|
||||
|
||||
#define CHAN2G(_channel, _freq, _flags) { \
|
||||
.band = IEEE80211_BAND_2GHZ, \
|
||||
.hw_value = (_channel), \
|
||||
.center_freq = (_freq), \
|
||||
.flags = (_flags), \
|
||||
.max_antenna_gain = 0, \
|
||||
.max_power = 30, \
|
||||
}
|
||||
|
||||
static struct ieee80211_channel esp_2ghz_channels[] = {
|
||||
CHAN2G(1, 2412, 0),
|
||||
CHAN2G(2, 2417, 0),
|
||||
CHAN2G(3, 2422, 0),
|
||||
CHAN2G(4, 2427, 0),
|
||||
CHAN2G(5, 2432, 0),
|
||||
CHAN2G(6, 2437, 0),
|
||||
CHAN2G(7, 2442, 0),
|
||||
CHAN2G(8, 2447, 0),
|
||||
CHAN2G(9, 2452, 0),
|
||||
CHAN2G(10, 2457, 0),
|
||||
CHAN2G(11, 2462, 0),
|
||||
CHAN2G(12, 2467, 0),
|
||||
CHAN2G(13, 2472, 0),
|
||||
CHAN2G(14, 2484, 0),
|
||||
};
|
||||
|
||||
static int esp_cfg80211_change_iface(struct wiphy *wiphy,
|
||||
struct net_device *ndev,
|
||||
enum nl80211_iftype type, u32 *flags,
|
||||
struct vif_params *params)
|
||||
{
|
||||
struct esp_pub *epub = wdev_priv(dev->ieee80211_ptr);
|
||||
struct wireless_dev *wdev = epub->wdev;
|
||||
|
||||
|
||||
/* only support STA mode for now */
|
||||
if (type != NL80211_IFTYPE_STATION)
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
wdev->iftype = type;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int esp_cfg80211_scan(struct wiphy *wiphy, struct net_device *ndev,
|
||||
struct cfg80211_scan_request *request)
|
||||
{
|
||||
struct esp_pub *epub = wdev_priv(dev->ieee80211_ptr);
|
||||
int ret = 0;
|
||||
|
||||
if (!esp_ready(ar))
|
||||
return -EIO;
|
||||
|
||||
if (request->n_ssids && request->ssids[0].ssid_len) {
|
||||
u8 i;
|
||||
|
||||
if (request->n_ssids > (MAX_PROBED_SSID_INDEX - 1))
|
||||
request->n_ssids = MAX_PROBED_SSID_INDEX - 1;
|
||||
|
||||
for (i = 0; i < request->n_ssids; i++)
|
||||
esp_wl_probedssid_cmd(epub->wl, i + 1,
|
||||
SPECIFIC_SSID_FLAG,
|
||||
request->ssids[i].ssid_len,
|
||||
request->ssids[i].ssid);
|
||||
}
|
||||
|
||||
if (esp_wl_startscan_cmd(epub->wl, WL_LONG_SCAN, 0,
|
||||
false, 0, 0, 0, NULL) != 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "wl_startscan_cmd failed\n");
|
||||
ret = -EIO;
|
||||
}
|
||||
|
||||
epub->wl->scan_req = request;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static struct cfg80211_ops esp_cfg80211_ops = {
|
||||
.change_virtual_intf = esp_cfg80211_change_iface,
|
||||
.scan = esp_cfg80211_scan,
|
||||
.connect = esp_cfg80211_connect,
|
||||
.disconnect = esp_cfg80211_disconnect,
|
||||
.add_key = esp_cfg80211_add_key,
|
||||
.get_key = esp_cfg80211_get_key,
|
||||
.del_key = esp_cfg80211_del_key,
|
||||
.set_default_key = esp_cfg80211_set_default_key,
|
||||
.set_wiphy_params = esp_cfg80211_set_wiphy_params,
|
||||
.set_tx_power = esp_cfg80211_set_txpower,
|
||||
.get_tx_power = esp_cfg80211_get_txpower,
|
||||
.set_power_mgmt = esp_cfg80211_set_power_mgmt,
|
||||
.join_ibss = esp_cfg80211_join_ibss,
|
||||
.leave_ibss = esp_cfg80211_leave_ibss,
|
||||
.get_station = esp_get_station,
|
||||
.set_pmksa = esp_set_pmksa,
|
||||
.del_pmksa = esp_del_pmksa,
|
||||
.flush_pmksa = esp_flush_pmksa,
|
||||
};
|
||||
|
||||
static struct ieee80211_ops esp_ieee80211_ops = {
|
||||
}
|
||||
|
||||
static struct cfg80211_ops esp_cfg80211_ops = {0};
|
||||
|
||||
static struct ieee80211_rate esp_g_rates[] = {
|
||||
RATETAB_ENT(10, 0x1, 0),
|
||||
RATETAB_ENT(20, 0x2, 0),
|
||||
RATETAB_ENT(55, 0x4, 0),
|
||||
RATETAB_ENT(110, 0x8, 0),
|
||||
RATETAB_ENT(60, 0x10, 0),
|
||||
RATETAB_ENT(90, 0x20, 0),
|
||||
RATETAB_ENT(120, 0x40, 0),
|
||||
RATETAB_ENT(180, 0x80, 0),
|
||||
RATETAB_ENT(240, 0x100, 0),
|
||||
RATETAB_ENT(360, 0x200, 0),
|
||||
RATETAB_ENT(480, 0x400, 0),
|
||||
RATETAB_ENT(540, 0x800, 0),
|
||||
};
|
||||
|
||||
#define esp_g_rates_size 12
|
||||
static struct ieee80211_supported_band esp_band_2ghz = {
|
||||
.n_channels = ARRAY_SIZE(esp_2ghz_channels),
|
||||
.channels = esp_2ghz_channels,
|
||||
.n_bitrates = esp_g_rates_size,
|
||||
.bitrates = esp_g_rates,
|
||||
};
|
||||
|
||||
static const u32 cipher_suites[] = {
|
||||
WLAN_CIPHER_SUITE_WEP40,
|
||||
WLAN_CIPHER_SUITE_WEP104,
|
||||
WLAN_CIPHER_SUITE_TKIP,
|
||||
WLAN_CIPHER_SUITE_CCMP,
|
||||
};
|
||||
|
||||
static struct wireless_dev *
|
||||
esp_cfg80211_init(struct device *dev) {
|
||||
int ret = 0;
|
||||
struct wireless_dev *wdev;
|
||||
|
||||
wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
|
||||
|
||||
if (!wdev) {
|
||||
esp_dbg(ESP_DBG_ERROR, "couldn't allocate wireless device\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wdev->wiphy = wiphy_new(&esp_cfg80211_ops, sizeof(struct esp_pub));
|
||||
|
||||
if (!wdev->wiphy) {
|
||||
esp_dbg(ESP_DBG_ERROR, "couldn't allocate wiphy device\n");
|
||||
kfree(wdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
set_wiphy_dev(wdev->wiphy, dev);
|
||||
|
||||
wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION);
|
||||
wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
|
||||
wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &esp_band_2ghz;
|
||||
//wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &esp_band_5ghz;
|
||||
wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
|
||||
|
||||
wdev->wiphy->cipher_suites = cipher_suites;
|
||||
wdev->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
|
||||
|
||||
ret = wiphy_register(wdev->wiphy);
|
||||
|
||||
if (ret < 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "couldn't register wiphy device\n");
|
||||
wiphy_free(wdev->wiphy);
|
||||
kfree(wdev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return wdev;
|
||||
}
|
||||
|
||||
static void
|
||||
esp_cfg80211_descory(struct esp_pub *pub)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static int esp_open(struct net_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_stats *
|
||||
esp_get_stats(struct net_device *dev) {
|
||||
struct net_device_stats *stats = NULL;
|
||||
return stats;
|
||||
}
|
||||
|
||||
static int esp_close(struct net_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int esp_data_tx(struct sk_buff *skb, struct net_device *dev)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct net_device_ops esp_netdev_ops = {
|
||||
.ndo_open = esp_open,
|
||||
.ndo_stop = esp_close,
|
||||
.ndo_start_xmit = esp_data_tx,
|
||||
.ndo_get_stats = esp_get_stats,
|
||||
};
|
||||
|
||||
static inline void
|
||||
esp_init_netdev(struct net_device *dev)
|
||||
{
|
||||
dev->netdev_ops = &esp_netdev_ops;
|
||||
dev->watchdog_timeo = 10;
|
||||
|
||||
dev->needed_headroom = ETH_HLEN + sizeof(struct llc_snap_hdr) + SIP_HDR_LEN;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
esp_disconnect(struct esp_pub *epub)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
esp_disconnect_timeout_handler(unsigned long ptr)
|
||||
{
|
||||
struct net_device *netdev = (struct net_device *)ptr;
|
||||
struct esp_pub *epub = wdev_priv(netdev->ieee80211_ptr);
|
||||
|
||||
//esp_init_profile(epub);
|
||||
esp_disconnect(epub);
|
||||
}
|
||||
|
||||
struct esp_pub *
|
||||
esp_pub_alloc_cfg80211(struct device *dev) {
|
||||
struct net_device *netdev;
|
||||
struct wireless_dev *wdev;
|
||||
struct esp_pub *epub;
|
||||
struct esp_wl *wl;
|
||||
|
||||
wdev = esp_cfg80211_init(dev);
|
||||
|
||||
if (wdev == NULL) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: cfg80211_init failed \n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
epub = wdev_priv(wdev);
|
||||
epub->dev = dev;
|
||||
epub->wdev = wdev;
|
||||
wdev->iftype = NL80211_IFTYPE_STATION;
|
||||
|
||||
/* Still register ethernet device */
|
||||
netdev = alloc_netdev(0, "wlan%d", ether_setup);
|
||||
|
||||
if (!netdev) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: alloc_netdev failed \n", __func__);
|
||||
esp_cfg80211_descory(epub);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
netdev->ieee80211_ptr = wdev;
|
||||
SET_NETDEV_DEV(netdev, wiphy_dev(wdev->wiphy));
|
||||
wdev->netdev = netdev;
|
||||
|
||||
esp_init_netdev(netdev);
|
||||
|
||||
epub->net_dev = netdev;
|
||||
|
||||
//spin_lock_init(&epub->lock);
|
||||
|
||||
wl = &epub->wl;
|
||||
//esp_init_wl(wl);
|
||||
init_waitqueue_head(&epub->ev_waitq);
|
||||
//sema_init(epub->sem, 1);
|
||||
|
||||
INIT_LIST_HEAD(&wl->amsdu_rx_buffer_queue);
|
||||
|
||||
setup_timer(&wl->disconnect_timer, esp_disconnect_timeout_handler,
|
||||
(unsigned long) netdev);
|
||||
|
||||
return epub;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2009 - 2012 Espressif System.
|
||||
* Copyright (c) 2009 - 2014 Espressif System.
|
||||
*
|
||||
* SIP ctrl packet parse and pack
|
||||
*/
|
||||
|
||||
#include <net/mac80211.h>
|
||||
|
|
@ -13,14 +15,11 @@
|
|||
#include "esp_ctrl.h"
|
||||
#include "esp_sif.h"
|
||||
#include "esp_debug.h"
|
||||
#include "slc_host_register.h"
|
||||
#include "esp_wmac.h"
|
||||
#include "esp_utils.h"
|
||||
#include "esp_wl.h"
|
||||
#ifdef ANDROID
|
||||
#include "esp_android.h"
|
||||
#include "esp_file.h"
|
||||
#include "esp_path.h"
|
||||
#endif /* ANDROID */
|
||||
#ifdef TEST_MODE
|
||||
#include "testmode.h"
|
||||
#endif /* TEST_MODE */
|
||||
|
|
@ -28,13 +27,6 @@
|
|||
|
||||
extern struct completion *gl_bootup_cplx;
|
||||
|
||||
#ifdef ESP_RX_COPYBACK_TEST
|
||||
static void sip_show_copyback_buf(void)
|
||||
{
|
||||
//show_buf(copyback_buf, copyback_offset);
|
||||
}
|
||||
#endif /* ESP_RX_COPYBACK_TEST */
|
||||
|
||||
static void esp_tx_ba_session_op(struct esp_sip *sip, struct esp_node *node, trc_ampdu_state_t state, u8 tid )
|
||||
{
|
||||
struct esp_tx_tid *txtid;
|
||||
|
|
@ -88,6 +80,52 @@ static void esp_tx_ba_session_op(struct esp_sip *sip, struct esp_node *node, trc
|
|||
}
|
||||
}
|
||||
|
||||
int sip_parse_event_debug(struct esp_pub *epub, const u8 *src, u8 *dst)
|
||||
{
|
||||
struct sip_evt_debug* debug_evt = (struct sip_evt_debug *)(src + SIP_CTRL_HDR_LEN);
|
||||
|
||||
switch (debug_evt->results[0]) {
|
||||
case RDRSSI: {
|
||||
u32 mask = debug_evt->results[1];
|
||||
u8 *p = (u8 *)&debug_evt->results[2];
|
||||
u8 index;
|
||||
struct esp_node *enode;
|
||||
|
||||
while (mask != 0) {
|
||||
index = ffs(mask) - 1;
|
||||
if (index >= ESP_PUB_MAX_STA)
|
||||
break;
|
||||
enode = esp_get_node_by_index(epub, index);
|
||||
if (enode == NULL) {
|
||||
esp_dbg(ESP_DBG_ERROR, "trc mask dismatch");
|
||||
} else {
|
||||
dst += sprintf(dst, "%02x:%02x:%02x:%02x:%02x:%02x 0x%x 0x%x\n",
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
enode->sta->addr[0], enode->sta->addr[1], enode->sta->addr[2],
|
||||
enode->sta->addr[3], enode->sta->addr[4], enode->sta->addr[5],
|
||||
#else
|
||||
enode->addr[0], enode->addr[1], enode->addr[2],
|
||||
enode->addr[3], enode->addr[4], enode->addr[5],
|
||||
#endif
|
||||
*p, *(p+1));
|
||||
p += 2;
|
||||
}
|
||||
mask &= ~(1<<index);
|
||||
};
|
||||
dst += sprintf(dst, "%c", '\0');
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
int i;
|
||||
for(i = 1; i < debug_evt->len; i++)
|
||||
dst += sprintf(dst, "0x%x%s", debug_evt->results[i], i == debug_evt->len -1 ? "":" " );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
||||
{
|
||||
struct sip_hdr *hdr = (struct sip_hdr *)buf;
|
||||
|
|
@ -117,8 +155,8 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
break;
|
||||
}
|
||||
case SIP_EVT_RESETTING:{
|
||||
sip->epub->wait_reset = 1;
|
||||
if (gl_bootup_cplx)
|
||||
sip->epub->wait_reset = 1;
|
||||
if (gl_bootup_cplx)
|
||||
complete(gl_bootup_cplx);
|
||||
break;
|
||||
}
|
||||
|
|
@ -151,7 +189,7 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
break;
|
||||
}
|
||||
|
||||
case SIP_EVT_ROC: {
|
||||
case SIP_EVT_ROC: {
|
||||
struct sip_evt_roc* report = (struct sip_evt_roc *)(buf + SIP_CTRL_HDR_LEN);
|
||||
esp_rocdone_process(sip->epub->hw, report);
|
||||
break;
|
||||
|
|
@ -172,7 +210,6 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
|
||||
//how about totlen % 256 == 0??
|
||||
if (hdr->hdr.len < 256) {
|
||||
//sip_show_copyback_buf();
|
||||
kfree(copyback_buf);
|
||||
}
|
||||
}
|
||||
|
|
@ -191,12 +228,9 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
}
|
||||
|
||||
case SIP_EVT_DEBUG: {
|
||||
u8 check_str[100];
|
||||
int i;
|
||||
char * ptr_str = (char *)& check_str;
|
||||
struct sip_evt_debug* debug_evt = (struct sip_evt_debug *)(buf + SIP_CTRL_HDR_LEN);
|
||||
for(i = 0; i < debug_evt->len; i++)
|
||||
ptr_str += sprintf(ptr_str, "0x%x%s", debug_evt->results[i], i == debug_evt->len -1 ? "":" " );
|
||||
u8 check_str[640];
|
||||
sip_parse_event_debug(sip->epub, buf, check_str);
|
||||
esp_dbg(ESP_DBG_TRACE, "%s", check_str);
|
||||
esp_test_cmd_event(TEST_CMD_DEBUG, (char *)&check_str);
|
||||
break;
|
||||
}
|
||||
|
|
@ -229,16 +263,14 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
sprintf(test_res_str, "esp_host:%llx\nesp_target: %.*s", DRIVER_VER, *len, p);
|
||||
|
||||
esp_dbg(ESP_SHOW, "%s\n", test_res_str);
|
||||
#ifdef ANDROID
|
||||
if(*len && sip->epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT){
|
||||
char filename[256];
|
||||
if (mod_eagle_path_get() == NULL)
|
||||
sprintf(filename, "%s/%s", FWPATH, "test_results");
|
||||
else
|
||||
sprintf(filename, "%s/%s", mod_eagle_path_get(), "test_results");
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case SIP_EVT_TRC_AMPDU: {
|
||||
|
|
@ -254,42 +286,38 @@ int sip_parse_events(struct esp_sip *sip, u8 *buf)
|
|||
node = esp_get_node_by_addr(sip->epub, ep->addr);
|
||||
if(node == NULL)
|
||||
break;
|
||||
#if 0
|
||||
esp_tx_ba_session_op(sip, node, ep->state, ep->tid);
|
||||
#else
|
||||
for (i = 0; i < 8; i++) {
|
||||
if (ep->tid & (1<<i)) {
|
||||
esp_tx_ba_session_op(sip, node, ep->state, i);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
case SIP_EVT_EP: {
|
||||
char *ep = (char *)(buf + SIP_CTRL_HDR_LEN);
|
||||
static int counter = 0;
|
||||
|
||||
esp_dbg(ESP_ATE, "%s EVT_EP \n\n", __func__);
|
||||
if (counter++ < 2) {
|
||||
esp_dbg(ESP_ATE, "ATE: %s \n", ep);
|
||||
}
|
||||
case SIP_EVT_EP: {
|
||||
char *ep = (char *)(buf + SIP_CTRL_HDR_LEN);
|
||||
static int counter = 0;
|
||||
|
||||
esp_test_ate_done_cb(ep);
|
||||
esp_dbg(ESP_ATE, "%s EVT_EP \n\n", __func__);
|
||||
if (counter++ < 2) {
|
||||
esp_dbg(ESP_ATE, "ATE: %s \n", ep);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
esp_test_ate_done_cb(ep);
|
||||
|
||||
break;
|
||||
}
|
||||
case SIP_EVT_INIT_EP: {
|
||||
char *ep = (char *)(buf + SIP_CTRL_HDR_LEN);
|
||||
esp_dbg(ESP_ATE, "Phy Init: %s \n", ep);
|
||||
break;
|
||||
}
|
||||
char *ep = (char *)(buf + SIP_CTRL_HDR_LEN);
|
||||
esp_dbg(ESP_ATE, "Phy Init: %s \n", ep);
|
||||
break;
|
||||
}
|
||||
|
||||
case SIP_EVT_NOISEFLOOR:{
|
||||
struct sip_evt_noisefloor *ep = (struct sip_evt_noisefloor *)(buf + SIP_CTRL_HDR_LEN);
|
||||
atomic_set(&sip->noise_floor, ep->noise_floor);
|
||||
break;
|
||||
}
|
||||
struct sip_evt_noisefloor *ep = (struct sip_evt_noisefloor *)(buf + SIP_CTRL_HDR_LEN);
|
||||
atomic_set(&sip->noise_floor, ep->noise_floor);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -310,11 +338,8 @@ void sip_send_chip_init(struct esp_sip *sip)
|
|||
const struct firmware *fw_entry;
|
||||
u8 * esp_init_data = NULL;
|
||||
int ret = 0;
|
||||
#ifdef ANDROID
|
||||
ret = android_request_firmware(&fw_entry, ESP_INIT_NAME, sip->epub->dev);
|
||||
#else
|
||||
ret = request_firmware(&fw_entry, ESP_INIT_NAME, sip->epub->dev);
|
||||
#endif /* ANDROID */
|
||||
|
||||
ret = esp_request_firmware(&fw_entry, ESP_INIT_NAME, sip->epub->dev);
|
||||
|
||||
if (ret) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s =============ERROR! NO INIT DATA!!=================\n", __func__);
|
||||
|
|
@ -324,11 +349,7 @@ void sip_send_chip_init(struct esp_sip *sip)
|
|||
|
||||
size = fw_entry->size;
|
||||
|
||||
#ifdef ANDROID
|
||||
android_release_firmware(fw_entry);
|
||||
#else
|
||||
release_firmware(fw_entry);
|
||||
#endif /* ANDROID */
|
||||
esp_release_firmware(fw_entry);
|
||||
|
||||
if (esp_init_data == NULL) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s =============ERROR! NO MEMORY!!=================\n", __func__);
|
||||
|
|
@ -339,11 +360,8 @@ void sip_send_chip_init(struct esp_sip *sip)
|
|||
|
||||
#endif /* !HAS_INIT_DATA */
|
||||
|
||||
#ifdef ANDROID
|
||||
//show_init_buf(esp_init_data,size);
|
||||
fix_init_data(esp_init_data, size);
|
||||
//show_init_buf(esp_init_data,size);
|
||||
#endif
|
||||
|
||||
atomic_sub(1, &sip->tx_credits);
|
||||
|
||||
sip_send_cmd(sip, SIP_CMD_INIT, size, (void *)esp_init_data);
|
||||
|
|
@ -373,7 +391,7 @@ int sip_send_config(struct esp_pub *epub, struct ieee80211_conf * conf)
|
|||
configcmd->center_freq= conf->channel->center_freq;
|
||||
#endif
|
||||
configcmd->duration= 0;
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
int sip_send_bss_info_update(struct esp_pub *epub, struct esp_vif *evif, u8 *bssid, int assoc)
|
||||
|
|
@ -397,7 +415,7 @@ int sip_send_bss_info_update(struct esp_pub *epub, struct esp_vif *evif, u8 *bs
|
|||
bsscmd->isassoc= assoc;
|
||||
bsscmd->beacon_int = evif->beacon_interval;
|
||||
memcpy(bsscmd->bssid, bssid, ETH_ALEN);
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
int sip_send_wmm_params(struct esp_pub *epub, u8 aci, const struct ieee80211_tx_queue_params *params)
|
||||
|
|
@ -416,7 +434,7 @@ int sip_send_wmm_params(struct esp_pub *epub, u8 aci, const struct ieee80211_tx
|
|||
bsscmd->ecw_min = 32 - __builtin_clz(params->cw_min);
|
||||
bsscmd->ecw_max= 32 -__builtin_clz(params->cw_max);
|
||||
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
int sip_send_ampdu_action(struct esp_pub *epub, u8 action_num, const u8 * addr, u16 tid, u16 ssn, u8 buf_size)
|
||||
|
|
@ -453,7 +471,7 @@ int sip_send_ampdu_action(struct esp_pub *epub, u8 action_num, const u8 * addr,
|
|||
break;
|
||||
}
|
||||
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
#ifdef HW_SCAN
|
||||
|
|
@ -515,7 +533,7 @@ int sip_send_scan(struct esp_pub *epub)
|
|||
|
||||
}
|
||||
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -531,7 +549,7 @@ int sip_send_suspend_config(struct esp_pub *epub, u8 suspend)
|
|||
|
||||
cmd = (struct sip_cmd_suspend *)(skb->data + sizeof(struct sip_hdr));
|
||||
cmd->suspend = suspend;
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
int sip_send_ps_config(struct esp_pub *epub, struct esp_ps *ps)
|
||||
|
|
@ -552,7 +570,7 @@ int sip_send_ps_config(struct esp_pub *epub, struct esp_ps *ps)
|
|||
pscmd->dtim_period = ps->dtim_period;
|
||||
pscmd->max_sleep_period = ps->max_sleep_period;
|
||||
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
void sip_scandone_process(struct esp_sip *sip, struct sip_evt_scan_report *scan_report)
|
||||
|
|
@ -612,7 +630,7 @@ int sip_send_setkey(struct esp_pub *epub, u8 bssid_no, u8 *peer_addr, struct iee
|
|||
} else {
|
||||
setkeycmd->flags=0;
|
||||
}
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
#ifdef FPGA_LOOPBACK
|
||||
|
|
@ -660,7 +678,7 @@ int sip_send_loopback_mblk(struct esp_sip *sip, int txpacket_len, int rxpacket_l
|
|||
}
|
||||
}
|
||||
|
||||
ret = sip_cmd_enqueue(sip, skb);
|
||||
ret = sip_cmd_enqueue(sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
if (ret <0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -680,7 +698,7 @@ int sip_send_roc(struct esp_pub *epub, u16 center_freq, u16 duration)
|
|||
configcmd = (struct sip_cmd_config *)(skb->data + sizeof(struct sip_hdr));
|
||||
configcmd->center_freq= center_freq;
|
||||
configcmd->duration= duration;
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 28))
|
||||
|
|
@ -745,7 +763,18 @@ int sip_send_set_sta(struct esp_pub *epub, u8 ifidx, u8 set, struct esp_node *no
|
|||
}
|
||||
}
|
||||
#endif
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
||||
int sip_send_recalc_credit(struct esp_pub *epub)
|
||||
{
|
||||
struct sk_buff *skb = NULL;
|
||||
|
||||
skb = sip_alloc_ctrl_skbuf(epub->sip, 0 + sizeof(struct sip_hdr), SIP_CMD_RECALC_CREDIT);
|
||||
if (!skb)
|
||||
return -ENOMEM;
|
||||
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_HEAD);
|
||||
}
|
||||
|
||||
int sip_cmd(struct esp_pub *epub, enum sip_cmd_id cmd_id, u8 *cmd_buf, u8 cmd_len)
|
||||
|
|
@ -758,5 +787,5 @@ int sip_cmd(struct esp_pub *epub, enum sip_cmd_id cmd_id, u8 *cmd_buf, u8 cmd_le
|
|||
|
||||
memcpy(skb->data + sizeof(struct sip_hdr), cmd_buf, cmd_len);
|
||||
|
||||
return sip_cmd_enqueue(epub->sip, skb);
|
||||
return sip_cmd_enqueue(epub->sip, skb, ENQUEUE_PRIOR_TAIL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2009- 2012 Espressif System.
|
||||
* Copyright (c) 2009- 2014 Espressif System.
|
||||
*
|
||||
* SIP ctrl packet parse and pack
|
||||
*/
|
||||
#ifndef _ESP_CTRL_H_
|
||||
#define _ESP_CTRL_H_
|
||||
|
|
@ -35,11 +36,9 @@ int sip_send_ps_config(struct esp_pub *epub, struct esp_ps *ps);
|
|||
|
||||
int sip_parse_events(struct esp_sip *sip, u8 *buf);
|
||||
|
||||
int sip_cmd(struct esp_pub *epub, enum sip_cmd_id cmd_id, u8 *cmd_buf, u8 cmd_len);
|
||||
int sip_send_recalc_credit(struct esp_pub *epub);
|
||||
|
||||
#ifdef ESP_RX_COPYBACK_TEST
|
||||
int sip_show_copyback_buf(void);
|
||||
#endif /* ESP_RX_COPYBACK_TEST */
|
||||
int sip_cmd(struct esp_pub *epub, enum sip_cmd_id cmd_id, u8 *cmd_buf, u8 cmd_len);
|
||||
|
||||
#endif /* _ESP_CTRL_H_ */
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Espressif System.
|
||||
* Copyright (c) 2011-2014 Espressif System.
|
||||
*
|
||||
* esp debug interface
|
||||
* - debugfs
|
||||
* - debug level control
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Espressif System.
|
||||
* Copyright (c) 2011-2014 Espressif System.
|
||||
*
|
||||
* esp debug
|
||||
*/
|
||||
|
||||
#ifndef _DEBUG_H_
|
||||
|
|
@ -55,8 +56,8 @@ extern unsigned int esp_msg_level;
|
|||
extern bool log_off;
|
||||
#endif /* ESP_ANDROID_LOGGER */
|
||||
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
#include "esp_android.h"
|
||||
#ifdef ESP_ANDROID_LOGGER
|
||||
#include "esp_file.h"
|
||||
#define esp_dbg(mask, fmt, args...) do { \
|
||||
if (esp_msg_level & mask) \
|
||||
{ \
|
||||
|
|
@ -71,7 +72,7 @@ extern bool log_off;
|
|||
if (esp_msg_level & mask) \
|
||||
printk(fmt, ##args); \
|
||||
} while (0)
|
||||
#endif /* ANDROID && ESP_ANDROID_LOGGER */
|
||||
#endif /* ESP_ANDROID_LOGGER */
|
||||
|
||||
void show_buf(u8 *buf, u32 len);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,3 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2010 -2013 Espressif System.
|
||||
*
|
||||
* extended gpio
|
||||
* - interface for other driver or kernel
|
||||
* - gpio control
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef USE_EXT_GPIO
|
||||
|
||||
#include <net/cfg80211.h>
|
||||
|
|
@ -118,7 +127,6 @@ int ext_gpio_release(int gpio_no)
|
|||
return -ERANGE;
|
||||
}
|
||||
sif_lock_bus(ext_epub);
|
||||
sif_raw_dummy_read(ext_epub,1);
|
||||
ret = sif_config_gpio_mode(ext_epub, (u8)gpio_no, EXT_GPIO_MODE_DISABLE);
|
||||
sif_unlock_bus(ext_epub);
|
||||
if (ret) {
|
||||
|
|
@ -205,7 +213,6 @@ int ext_gpio_set_mode(int gpio_no, int mode, void *data)
|
|||
}
|
||||
|
||||
sif_lock_bus(ext_epub);
|
||||
sif_raw_dummy_read(ext_epub,1);
|
||||
ret = sif_config_gpio_mode(ext_epub, (u8)gpio_no, gpio_mode);
|
||||
sif_unlock_bus(ext_epub);
|
||||
if (ret) {
|
||||
|
|
@ -278,7 +285,6 @@ int ext_gpio_set_output_state(int gpio_no, int state)
|
|||
}
|
||||
|
||||
sif_lock_bus(ext_epub);
|
||||
sif_raw_dummy_read(ext_epub,1);
|
||||
ret = sif_set_gpio_output(ext_epub, 1<<gpio_no, state<<gpio_no);
|
||||
sif_unlock_bus(ext_epub);
|
||||
if (ret) {
|
||||
|
|
@ -318,7 +324,6 @@ int ext_gpio_get_state(int gpio_no)
|
|||
state = gpio_list[gpio_no].gpio_state;
|
||||
} else if (gpio_list[gpio_no].gpio_mode == EXT_GPIO_MODE_INPUT) {
|
||||
sif_lock_bus(ext_epub);
|
||||
sif_raw_dummy_read(ext_epub,1);
|
||||
ret = sif_get_gpio_input(ext_epub, &mask, &state);
|
||||
sif_unlock_bus(ext_epub);
|
||||
if (ret) {
|
||||
|
|
@ -364,7 +369,6 @@ int ext_irq_ack(int gpio_no)
|
|||
}
|
||||
|
||||
sif_lock_bus(ext_epub);
|
||||
sif_raw_dummy_read(ext_epub,1);
|
||||
ret = sif_set_gpio_output(ext_epub, 0x00, 1<<gpio_no);
|
||||
sif_unlock_bus(ext_epub);
|
||||
if (ret) {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2010 -2014 Espressif System.
|
||||
*
|
||||
* file operation in kernel space
|
||||
*
|
||||
*/
|
||||
|
||||
#include <linux/fs.h>
|
||||
#include <linux/vmalloc.h>
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -7,15 +14,14 @@
|
|||
#include <linux/netdevice.h>
|
||||
#include <linux/aio.h>
|
||||
|
||||
#include "esp_android.h"
|
||||
#include "esp_file.h"
|
||||
#include "esp_debug.h"
|
||||
#include "esp_sif.h"
|
||||
|
||||
#ifdef ANDROID
|
||||
#include "esp_path.h"
|
||||
#include "esp_conf.h"
|
||||
|
||||
int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length)
|
||||
int esp_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length)
|
||||
{
|
||||
int ret = 0;
|
||||
struct file *filp = (struct file *)-ENOENT;
|
||||
|
|
@ -24,7 +30,7 @@ int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, s
|
|||
set_fs(KERNEL_DS);
|
||||
do {
|
||||
int mode = (wbuf) ? O_RDWR | O_CREAT : O_RDONLY;
|
||||
filp = filp_open(filename, mode, S_IRUSR);
|
||||
filp = filp_open(filename, mode, (S_IRUSR | S_IWUSR));
|
||||
if (IS_ERR(filp) || !filp->f_op) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: file %s filp_open error\n", __FUNCTION__, filename);
|
||||
ret = -ENOENT;
|
||||
|
|
@ -48,13 +54,13 @@ int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, s
|
|||
if (wbuf) {
|
||||
if ( (ret=filp->f_op->write(filp, wbuf, length, &filp->f_pos)) < 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: Write %u bytes to file %s error %d\n", __FUNCTION__,
|
||||
length, filename, ret);
|
||||
(unsigned int)length, filename, ret);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if ( (ret=filp->f_op->read(filp, rbuf, length, &filp->f_pos)) < 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: Read %u bytes from file %s error %d\n", __FUNCTION__,
|
||||
length, filename, ret);
|
||||
(unsigned int)length, filename, ret);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -68,7 +74,7 @@ int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, s
|
|||
return ret;
|
||||
}
|
||||
|
||||
int android_request_firmware(const struct firmware **firmware_p, const char *name,
|
||||
int esp_request_firmware(const struct firmware **firmware_p, const char *name,
|
||||
struct device *device)
|
||||
{
|
||||
int ret = 0;
|
||||
|
|
@ -89,7 +95,7 @@ int android_request_firmware(const struct firmware **firmware_p, const char *nam
|
|||
do {
|
||||
size_t length, bufsize, bmisize;
|
||||
|
||||
if ( (ret=android_readwrite_file(filename, NULL, NULL, 0)) < 0) {
|
||||
if ( (ret=esp_readwrite_file(filename, NULL, NULL, 0)) < 0) {
|
||||
break;
|
||||
} else {
|
||||
length = ret;
|
||||
|
|
@ -106,8 +112,8 @@ int android_request_firmware(const struct firmware **firmware_p, const char *nam
|
|||
break;
|
||||
}
|
||||
|
||||
if ( (ret=android_readwrite_file(filename, (char*)firmware->data, NULL, length)) != length) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: file read error, ret %d request %d\n", __FUNCTION__, ret, length);
|
||||
if ( (ret=esp_readwrite_file(filename, (char*)firmware->data, NULL, length)) != length) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: file read error, ret %d request %d\n", __FUNCTION__, ret, (unsigned int)length);
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
|
|
@ -129,7 +135,7 @@ int android_request_firmware(const struct firmware **firmware_p, const char *nam
|
|||
return ret;
|
||||
}
|
||||
|
||||
void android_release_firmware(const struct firmware *firmware)
|
||||
void esp_release_firmware(const struct firmware *firmware)
|
||||
{
|
||||
if (firmware) {
|
||||
if (firmware->data)
|
||||
|
|
@ -139,6 +145,7 @@ void android_release_firmware(const struct firmware *firmware)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef ESP_ANDROID_LOGGER
|
||||
int logger_write( const unsigned char prio,
|
||||
const char __kernel * const tag,
|
||||
const char __kernel * const fmt,
|
||||
|
|
@ -210,7 +217,7 @@ int logger_write( const unsigned char prio,
|
|||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
struct esp_init_table_elem esp_init_table[MAX_ATTR_NUM] = {
|
||||
|
|
@ -271,7 +278,7 @@ void show_esp_init_table(struct esp_init_table_elem *econf)
|
|||
esp_init_table[i].value);
|
||||
}
|
||||
|
||||
int android_request_init_conf(void)
|
||||
int request_init_conf(void)
|
||||
{
|
||||
|
||||
u8 *conf_buf;
|
||||
|
|
@ -291,7 +298,7 @@ int android_request_init_conf(void)
|
|||
else
|
||||
sprintf(filename, "%s/%s", mod_eagle_path_get(), INIT_CONF_FILE);
|
||||
|
||||
if ((ret=android_readwrite_file(filename, NULL, NULL, 0)) < 0 || ret > MAX_BUF_LEN) {
|
||||
if ((ret=esp_readwrite_file(filename, NULL, NULL, 0)) < 0 || ret > MAX_BUF_LEN) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: file read length error, ret %d\n", __FUNCTION__, ret);
|
||||
return ret;
|
||||
} else {
|
||||
|
|
@ -305,7 +312,7 @@ int android_request_init_conf(void)
|
|||
}
|
||||
|
||||
#ifdef INIT_DATA_CONF
|
||||
if ((ret=android_readwrite_file(filename, conf_buf, NULL, length)) != length) {
|
||||
if ((ret=esp_readwrite_file(filename, conf_buf, NULL, length)) != length) {
|
||||
esp_dbg(ESP_DBG_ERROR, "%s: file read error, ret %d request %d\n", __FUNCTION__, ret, length);
|
||||
goto failed;
|
||||
}
|
||||
|
|
@ -401,15 +408,3 @@ void fix_init_data(u8 *init_data_buf, int buf_size)
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
void show_init_buf(u8 *buf, int size)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for (i = 0; i < size; i++)
|
||||
printk(KERN_ERR "offset[%d] [0x%02x]", i, buf[i]);
|
||||
printk(KERN_ERR "\n");
|
||||
|
||||
}
|
||||
|
||||
#endif //ANDROID
|
||||
|
|
@ -1,5 +1,12 @@
|
|||
#ifndef _ESP_ANDROID_H
|
||||
#define _ESP_ANDROID_H
|
||||
/*
|
||||
* Copyright (c) 2010 -2014 Espressif System.
|
||||
*
|
||||
* file operation in kernel space
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _ESP_FILE_H_
|
||||
#define _ESP_FILE_H_
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/firmware.h>
|
||||
|
|
@ -15,12 +22,11 @@
|
|||
|
||||
#define E_ROUND_UP(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
|
||||
|
||||
#ifdef ANDROID
|
||||
int android_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length);
|
||||
int esp_readwrite_file(const char *filename, char *rbuf, const char *wbuf, size_t length);
|
||||
|
||||
int android_request_firmware(const struct firmware **firmware_p, const char *name, struct device *device);
|
||||
int esp_request_firmware(const struct firmware **firmware_p, const char *name, struct device *device);
|
||||
|
||||
void android_release_firmware(const struct firmware *firmware);
|
||||
void esp_release_firmware(const struct firmware *firmware);
|
||||
|
||||
#ifdef INIT_DATA_CONF
|
||||
#define INIT_CONF_FILE "init_data.conf"
|
||||
|
|
@ -38,19 +44,16 @@ struct esp_init_table_elem {
|
|||
short value;
|
||||
};
|
||||
|
||||
int android_request_init_conf(void);
|
||||
int request_init_conf(void);
|
||||
void fix_init_data(u8 *init_data_buf, int buf_size);
|
||||
void show_init_buf(u8 *buf, int size);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
#ifdef ESP_ANDROID_LOGGER
|
||||
extern int logger_write( const unsigned char prio,
|
||||
const char __kernel * const tag,
|
||||
const char __kernel * const fmt,
|
||||
...);
|
||||
|
||||
|
||||
#endif // ANDROID
|
||||
#endif
|
||||
|
||||
#endif /* _ESP_FILE_H_ */
|
||||
|
|
@ -1,3 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2009 - 2014 Espressif System.
|
||||
* IO interface
|
||||
* - sdio/spi common i/f driver
|
||||
* - target sdio hal
|
||||
*/
|
||||
|
||||
#include <linux/mmc/sdio_func.h>
|
||||
#include "esp_sif.h"
|
||||
#include "slc_host_register.h"
|
||||
|
|
@ -14,16 +21,14 @@ int esp_common_read(struct esp_pub *epub, u8 *buf, u32 len, int sync, bool norou
|
|||
return sif_lldesc_read_sync(epub, buf, len);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
//return sif_spi_read_sync(epub, buf, len, NOT_CHECK_IDLE);
|
||||
return sif_spi_read_sync(epub, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_read_sync(epub, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ESP_USE_SDIO
|
||||
return sif_lldesc_read_raw(epub, buf, len, noround);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
//return sif_spi_read_nosync(epub, buf, len, NOT_CHECK_IDLE, noround);
|
||||
return sif_spi_read_nosync(epub, buf, len, NOT_DUMMYMODE, noround,0);
|
||||
return sif_spi_read_nosync(epub, buf, len, NOT_DUMMYMODE, noround);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -36,16 +41,14 @@ int esp_common_write(struct esp_pub *epub, u8 *buf, u32 len, int sync)
|
|||
return sif_lldesc_write_sync(epub, buf, len);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
//return sif_spi_write_sync(epub, buf, len, NOT_CHECK_IDLE);
|
||||
return sif_spi_write_sync(epub, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_write_sync(epub, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ESP_USE_SDIO
|
||||
return sif_lldesc_write_raw(epub, buf, len);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
//return sif_spi_write_nosync(epub, buf, len, NOT_CHECK_IDLE);
|
||||
return sif_spi_write_nosync(epub, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_write_nosync(epub, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -58,14 +61,14 @@ int esp_common_read_with_addr(struct esp_pub *epub, u32 addr, u8 *buf, u32 len,
|
|||
return sif_io_sync(epub, addr, buf, len, SIF_FROM_DEVICE | SIF_SYNC | SIF_BYTE_BASIS | SIF_INC_ADDR);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_read_mix_sync(epub, addr, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_read_mix_sync(epub, addr, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ESP_USE_SDIO
|
||||
return sif_io_raw(epub, addr, buf, len, SIF_FROM_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_read_mix_nosync(epub, addr, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_read_mix_nosync(epub, addr, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -79,14 +82,14 @@ int esp_common_write_with_addr(struct esp_pub *epub, u32 addr, u8 *buf, u32 len,
|
|||
return sif_io_sync(epub, addr, buf, len, SIF_TO_DEVICE | SIF_SYNC | SIF_BYTE_BASIS | SIF_INC_ADDR);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_write_mix_sync(epub, addr, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_write_mix_sync(epub, addr, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ESP_USE_SDIO
|
||||
return sif_io_raw(epub, addr, buf, len, SIF_TO_DEVICE | SIF_BYTE_BASIS | SIF_INC_ADDR);
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_write_mix_nosync(epub, addr, buf, len, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_write_mix_nosync(epub, addr, buf, len, NOT_DUMMYMODE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
@ -95,23 +98,23 @@ int esp_common_readbyte_with_addr(struct esp_pub *epub, u32 addr, u8 *buf, int s
|
|||
{
|
||||
if(sync){
|
||||
#ifdef ESP_USE_SDIO
|
||||
int res;
|
||||
sif_lock_bus(epub);
|
||||
*buf = sdio_io_readb(epub, addr, &res);
|
||||
sif_unlock_bus(epub);
|
||||
return res;
|
||||
int res;
|
||||
sif_lock_bus(epub);
|
||||
*buf = sdio_io_readb(epub, addr, &res);
|
||||
sif_unlock_bus(epub);
|
||||
return res;
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_read_mix_sync(epub, addr, buf, 1, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_read_mix_sync(epub, addr, buf, 1, NOT_DUMMYMODE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ESP_USE_SDIO
|
||||
int res;
|
||||
*buf = sdio_io_readb(epub, addr, &res);
|
||||
return res;
|
||||
int res;
|
||||
*buf = sdio_io_readb(epub, addr, &res);
|
||||
return res;
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_read_mix_nosync(epub, addr, buf, 1, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_read_mix_nosync(epub, addr, buf, 1, NOT_DUMMYMODE);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
@ -130,7 +133,7 @@ int esp_common_writebyte_with_addr(struct esp_pub *epub, u32 addr, u8 buf, int s
|
|||
return res;
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_write_mix_sync(epub, addr, &buf, 1, NOT_DUMMYMODE,0 );
|
||||
return sif_spi_epub_write_mix_sync(epub, addr, &buf, 1, NOT_DUMMYMODE);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef ESP_USE_SDIO
|
||||
|
|
@ -139,11 +142,109 @@ int esp_common_writebyte_with_addr(struct esp_pub *epub, u32 addr, u8 buf, int s
|
|||
return res;
|
||||
#endif
|
||||
#ifdef ESP_USE_SPI
|
||||
return sif_spi_epub_write_mix_nosync(epub, addr, &buf, 1, NOT_DUMMYMODE,0);
|
||||
return sif_spi_epub_write_mix_nosync(epub, addr, &buf, 1, NOT_DUMMYMODE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
int sif_read_reg_window(struct esp_pub *epub, unsigned int reg_addr, u8 *value)
|
||||
{
|
||||
u8 *p_tbuf = NULL;
|
||||
int ret = 0;
|
||||
int retry = 20;
|
||||
|
||||
reg_addr >>= 2;
|
||||
if(reg_addr > 0x1f)
|
||||
return -1;
|
||||
|
||||
p_tbuf = kzalloc(4, GFP_KERNEL);
|
||||
if(p_tbuf == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
p_tbuf[0] = 0x80 | (reg_addr & 0x1f);
|
||||
|
||||
ret = esp_common_write_with_addr(epub, SLC_HOST_WIN_CMD, p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
do{
|
||||
if(retry < 20)
|
||||
mdelay(10);
|
||||
retry --;
|
||||
ret = esp_common_read_with_addr(epub, SLC_HOST_STATE_W0, p_tbuf, 4, ESP_SIF_NOSYNC);
|
||||
}while(retry >0 && ret != 0);
|
||||
}
|
||||
|
||||
if(ret ==0)
|
||||
memcpy(value,p_tbuf,4);
|
||||
|
||||
kfree(p_tbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sif_write_reg_window(struct esp_pub *epub, unsigned int reg_addr,u8 *value)
|
||||
{
|
||||
u8 *p_tbuf = NULL;
|
||||
int ret = 0;
|
||||
|
||||
reg_addr >>= 2;
|
||||
if(reg_addr > 0x1f)
|
||||
return -1;
|
||||
|
||||
p_tbuf = kzalloc(8, GFP_KERNEL);
|
||||
if(p_tbuf == NULL)
|
||||
return -ENOMEM;
|
||||
memcpy(p_tbuf,value,4);
|
||||
p_tbuf[4] = 0xc0 |(reg_addr & 0x1f);
|
||||
|
||||
ret = esp_common_write_with_addr(epub, SLC_HOST_CONF_W5, p_tbuf, 5, ESP_SIF_NOSYNC);
|
||||
|
||||
kfree(p_tbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sif_ack_target_read_err(struct esp_pub *epub)
|
||||
{
|
||||
u32 value[1];
|
||||
int ret;
|
||||
|
||||
ret = sif_read_reg_window(epub, SLC_RX_LINK, (u8 *)value);
|
||||
if(ret)
|
||||
return ret;
|
||||
value[0] |= SLC_RXLINK_START;
|
||||
ret = sif_write_reg_window(epub, SLC_RX_LINK, (u8 *)value);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sif_had_io_enable(struct esp_pub *epub)
|
||||
{
|
||||
u32 *p_tbuf = NULL;
|
||||
int ret;
|
||||
|
||||
p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL);
|
||||
if(p_tbuf == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
*p_tbuf = SLC_TXEOF_ENA | (0x4 << SLC_FIFO_MAP_ENA_S) | SLC_TX_DUMMY_MODE | SLC_HDA_MAP_128K | (0xFE << SLC_TX_PUSH_IDLE_NUM_S);
|
||||
ret = sif_write_reg_window(epub, SLC_BRIDGE_CONF, (u8 *)p_tbuf);
|
||||
|
||||
if(ret)
|
||||
goto _err;
|
||||
|
||||
*p_tbuf = 0x30;
|
||||
ret = esp_common_write_with_addr((epub), SLC_HOST_CONF_W4 + 1, (u8 *)p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
|
||||
if(ret)
|
||||
goto _err;
|
||||
//set w3 0
|
||||
*p_tbuf = 0x1;
|
||||
ret = esp_common_write_with_addr((epub), SLC_HOST_CONF_W3, (u8 *)p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
|
||||
_err:
|
||||
kfree(p_tbuf);
|
||||
return ret;
|
||||
}
|
||||
|
||||
typedef enum _SDIO_INTR_MODE {
|
||||
SDIO_INTR_IB = 0,
|
||||
SDIO_INTR_OOB_TOGGLE,
|
||||
|
|
@ -278,135 +379,6 @@ int sif_get_gpio_input(struct esp_pub *epub, u16 *mask, u16 *value)
|
|||
}
|
||||
#endif
|
||||
|
||||
void sif_raw_dummy_read(struct esp_pub *epub ,int ext_gpio)
|
||||
{
|
||||
#if 0
|
||||
int retry = 0;
|
||||
u32 *p_tbuf = NULL;
|
||||
static u32 read_err_cnt = 0;
|
||||
static u32 write_err_cnt = 0;
|
||||
static u32 unknow_err_cnt = 0;
|
||||
static u32 check_cnt = 0;
|
||||
int ext_cnt = 0;
|
||||
int dummy_time = 0;
|
||||
#ifdef ESP_USE_SPI
|
||||
int read_err = 0;
|
||||
int write_err = 0;
|
||||
int sleep_time = 0;
|
||||
#endif
|
||||
|
||||
return ;
|
||||
if (atomic_read(&epub->ps.state) == ESP_PM_ON ||ext_gpio == 1 ) {
|
||||
|
||||
|
||||
// if (atomic_read(&epub->ps.state) == ESP_PM_ON ) {
|
||||
atomic_set(&epub->ps.state, ESP_PM_OFF);
|
||||
} else {
|
||||
return ;
|
||||
}
|
||||
|
||||
p_tbuf = kzalloc(sizeof(u32), GFP_KERNEL);
|
||||
ESSERT(p_tbuf != NULL);
|
||||
//*p_tbuf = 0;
|
||||
|
||||
// *p_tbuf = 0x010001ff;
|
||||
|
||||
*p_tbuf = 0x01;
|
||||
|
||||
|
||||
#ifdef ESP_USE_SPI
|
||||
write_err = sif_spi_epub_write_mix_nosync(epub, SLC_HOST_CONF_W4+3, (u8 *)p_tbuf, 1, DUMMYMODE,0);
|
||||
if(write_err == -4)
|
||||
{
|
||||
sleep_time ++;
|
||||
}
|
||||
#else
|
||||
esp_common_write_with_addr(epub, SLC_HOST_CONF_W4+3, (u8 *)p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
#endif
|
||||
do {
|
||||
dummy_time++;
|
||||
*p_tbuf = 0xffffffff;
|
||||
udelay(20);
|
||||
#ifdef ESP_USE_SPI
|
||||
read_err = sif_spi_epub_read_mix_nosync(epub, SLC_HOST_CONF_W4, (u8 *)p_tbuf, sizeof(u32), DUMMYMODE,0);
|
||||
if(read_err == -4 || read_err == -5)
|
||||
{
|
||||
sleep_time ++;
|
||||
}
|
||||
#else
|
||||
esp_common_read_with_addr(epub, SLC_HOST_CONF_W4, (u8 *)p_tbuf, sizeof(u32), ESP_SIF_NOSYNC);
|
||||
#endif
|
||||
if(dummy_time > 10)
|
||||
esp_dbg(ESP_DBG_ERROR, "w4 = %x,dummy time = %d\n",p_tbuf[0],dummy_time);
|
||||
|
||||
if(*p_tbuf == 0x020001ff){
|
||||
#ifdef ESP_USE_SPI
|
||||
#if 0
|
||||
if(--ext_cnt >= 0){
|
||||
mdelay(2);
|
||||
esp_common_write_with_addr(epub, SLC_HOST_CONF_W4, (u8 *)p_tbuf, sizeof(u32), ESP_SIF_NOSYNC);
|
||||
retry = -1;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
if(*p_tbuf == 0x010001ff){
|
||||
if(retry < 5)
|
||||
continue;
|
||||
}else if(*p_tbuf == 0x000001ff){
|
||||
write_err_cnt++;
|
||||
ext_cnt = 5;
|
||||
}else if(*p_tbuf == 0xffffffff){
|
||||
read_err_cnt++;
|
||||
// write_err_cnt++;
|
||||
ext_cnt = 5;
|
||||
}else {
|
||||
unknow_err_cnt++;
|
||||
ext_cnt = 5;
|
||||
}
|
||||
|
||||
// *p_tbuf = 0x010001ff;
|
||||
*p_tbuf = 0x01;
|
||||
udelay(20);
|
||||
#ifdef ESP_USE_SPI
|
||||
write_err = sif_spi_epub_write_mix_nosync(epub, SLC_HOST_CONF_W4+3, (u8 *)p_tbuf, 1, DUMMYMODE,0);
|
||||
if(write_err == -4)
|
||||
{
|
||||
sleep_time ++;
|
||||
}
|
||||
#else
|
||||
esp_common_write_with_addr(epub, SLC_HOST_CONF_W4+3, (u8 *)p_tbuf, 1, ESP_SIF_NOSYNC);
|
||||
#endif
|
||||
} while (retry++ < 1000);
|
||||
|
||||
kfree(p_tbuf);
|
||||
|
||||
if(read_err_cnt || write_err_cnt || unknow_err_cnt){
|
||||
if((check_cnt & 0xf) == 0)
|
||||
//esp_dbg(ESP_DBG_ERROR, "==============sdio err===============\n,read:%u, write:%u, unknow:%u\n", read_err_cnt,write_err_cnt,unknow_err_cnt);
|
||||
esp_dbg(ESP_DBG_ERROR, "r%u,w%u,u%u\n", read_err_cnt,write_err_cnt,unknow_err_cnt);
|
||||
check_cnt++;
|
||||
}
|
||||
#ifdef ESP_USE_SPI
|
||||
if(sleep_time >2)
|
||||
{
|
||||
esp_dbg(ESP_DBG_ERROR, "spierr sleep_time = %d,read_err = %d,write_err = %d\n", sleep_time,read_err,write_err);
|
||||
}
|
||||
#endif
|
||||
|
||||
// if (retry > 1) {
|
||||
// esp_dbg(ESP_DBG_ERROR, "=========%s tried %d times===========\n", __func__, retry - 1);
|
||||
//if (retry>=100)
|
||||
// ESSERT(0);
|
||||
// }
|
||||
#else
|
||||
return;
|
||||
#endif /* disable dummy read func */
|
||||
}
|
||||
|
||||
void check_target_id(struct esp_pub *epub)
|
||||
{
|
||||
u32 date;
|
||||
|
|
@ -491,11 +463,6 @@ u32 sif_get_target_id(struct esp_pub *epub)
|
|||
return 0x600;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SIF_CHECK_FIRST_INTR
|
||||
static bool first_intr_checked = false;
|
||||
#endif //SIF_CHECK_FIRST_INTR
|
||||
|
||||
#ifdef ESP_USE_SDIO
|
||||
void sif_dsr(struct sdio_func *func)
|
||||
{
|
||||
|
|
@ -504,13 +471,11 @@ void sif_dsr(struct sdio_func *func)
|
|||
void sif_dsr(struct spi_device *spi)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = spi_get_drvdata(spi);
|
||||
char buf[4];
|
||||
u32 buf[1];
|
||||
#endif
|
||||
#ifdef SIF_DSR_WAR
|
||||
static int dsr_cnt = 0, real_intr_cnt = 0, bogus_intr_cnt = 0;
|
||||
struct slc_host_regs *regs = &(sctrl->slc_regs);
|
||||
esp_dbg(ESP_DBG_TRACE, " %s enter %d \n", __func__, dsr_cnt++);
|
||||
#endif /* SIF_DSR_WAR */
|
||||
|
||||
#ifdef ESP_USE_SPI
|
||||
|
||||
|
|
@ -522,10 +487,10 @@ void sif_dsr(struct spi_device *spi)
|
|||
|
||||
if(sctrl->epub->enable_int == 1)
|
||||
{
|
||||
sif_spi_epub_read_mix_sync(sctrl->epub, 0x3, buf, 512, NOT_DUMMYMODE,1);
|
||||
buf[0]=buf[0]|(1<<2);
|
||||
buf[2]=buf[2]& 0xfd;
|
||||
sif_spi_epub_write_mix_sync(sctrl->epub, 0x3, buf, 512, NOT_DUMMYMODE,1);
|
||||
sif_read_reg_window(sctrl->epub, SLC_INT_ENA, (u8 *)buf);
|
||||
buf[0] &= ~(SLC_RX_EOF_INT_ENA);
|
||||
buf[0] |= SLC_FRHOST_BIT2_INT_ENA;
|
||||
sif_write_reg_window(sctrl->epub, SLC_INT_ENA, (u8 *)buf);
|
||||
|
||||
sctrl->epub->enable_int = 0;
|
||||
}
|
||||
|
|
@ -540,23 +505,14 @@ void sif_dsr(struct spi_device *spi)
|
|||
sif_lock_bus(sctrl->epub);
|
||||
|
||||
|
||||
#ifdef SIF_DSR_WAR
|
||||
do {
|
||||
int ret =0;
|
||||
#ifdef SIF_CHECK_FIRST_INTR
|
||||
if (likely(first_intr_checked)) {
|
||||
esp_dsr(sctrl->epub);
|
||||
break;
|
||||
}
|
||||
#endif //SIF_CHECK_FIRST_INTR
|
||||
|
||||
memset(regs, 0x0, sizeof(struct slc_host_regs));
|
||||
|
||||
ret = esp_common_read_with_addr(sctrl->epub, REG_SLC_HOST_BASE + 8, (u8 *)regs, sizeof(struct slc_host_regs), ESP_SIF_NOSYNC);
|
||||
if ( (regs->intr_status & SLC_HOST_RX_ST) && (regs->intr_raw & SLC_HOST_RX_ST) && (ret == 0) ) {
|
||||
#ifdef SIF_CHECK_FIRST_INTR
|
||||
first_intr_checked = true;
|
||||
#endif //SIF_CHECK_FIRST_INTR
|
||||
|
||||
memset(regs, 0x0, sizeof(struct slc_host_regs));
|
||||
|
||||
ret = esp_common_read_with_addr(sctrl->epub, REG_SLC_HOST_BASE + 8, (u8 *)regs, sizeof(struct slc_host_regs), ESP_SIF_NOSYNC);
|
||||
|
||||
if ( (regs->intr_raw & SLC_HOST_RX_ST) && (ret == 0) ) {
|
||||
esp_dbg(ESP_DBG_TRACE, "%s eal intr cnt: %d", __func__, ++real_intr_cnt);
|
||||
|
||||
esp_dsr(sctrl->epub);
|
||||
|
|
@ -576,10 +532,6 @@ void sif_dsr(struct spi_device *spi)
|
|||
|
||||
} while (0);
|
||||
|
||||
#else
|
||||
esp_dsr(sctrl->epub);
|
||||
#endif /* SIF_DSR_WAR */
|
||||
|
||||
#ifdef ESP_USE_SDIO
|
||||
sdio_claim_host(func);
|
||||
#endif
|
||||
|
|
@ -604,7 +556,6 @@ void sif_disable_target_interrupt(struct esp_pub *epub)
|
|||
#ifdef HOST_RESET_BUG
|
||||
mdelay(10);
|
||||
#endif
|
||||
sif_raw_dummy_read(epub,0);
|
||||
memset(EPUB_TO_CTRL(epub)->dma_buffer, 0x00, sizeof(u32));
|
||||
esp_common_write_with_addr(epub, SLC_HOST_INT_ENA, EPUB_TO_CTRL(epub)->dma_buffer, sizeof(u32), ESP_SIF_NOSYNC);
|
||||
#ifdef HOST_RESET_BUG
|
||||
|
|
@ -616,7 +567,6 @@ void sif_disable_target_interrupt(struct esp_pub *epub)
|
|||
mdelay(1);
|
||||
|
||||
sif_lock_bus(epub);
|
||||
sif_raw_dummy_read(epub,0);
|
||||
sif_interrupt_target(epub, 7);
|
||||
sif_unlock_bus(epub);
|
||||
_exit:
|
||||
|
|
|
|||
|
|
@ -1,8 +1,9 @@
|
|||
/*
|
||||
* Copyright (c) 2011 Espressif System.
|
||||
* Copyright (c) 2011-2014 Espressif System.
|
||||
*
|
||||
* MAC80211 support module
|
||||
*/
|
||||
|
||||
#include <linux/etherdevice.h>
|
||||
#include <linux/workqueue.h>
|
||||
#include <linux/nl80211.h>
|
||||
|
|
@ -23,6 +24,7 @@
|
|||
#include "esp_debug.h"
|
||||
#include "esp_wl.h"
|
||||
#include "esp_utils.h"
|
||||
#include <linux/rfkill-wlan.h>
|
||||
|
||||
#define ESP_IEEE80211_DBG esp_dbg
|
||||
|
||||
|
|
@ -527,7 +529,7 @@ static int esp_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
|
|||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29))
|
||||
ESP_IEEE80211_DBG(ESP_DBG_TRACE, "%s enter 0x%08x\n", __func__, changed);
|
||||
|
||||
if (changed&IEEE80211_CONF_CHANGE_CHANNEL) {
|
||||
if (changed & (IEEE80211_CONF_CHANGE_CHANNEL | IEEE80211_CONF_CHANGE_IDLE)) {
|
||||
sip_send_config(epub, &hw->conf);
|
||||
}
|
||||
#else
|
||||
|
|
@ -1033,7 +1035,7 @@ static int esp_node_detach(struct ieee80211_hw *hw, u8 ifidx, const u8 *addr)
|
|||
#endif
|
||||
{
|
||||
struct esp_pub *epub = (struct esp_pub *)hw->priv;
|
||||
u8 map;
|
||||
u32 map;
|
||||
int i;
|
||||
struct esp_node *node = NULL;
|
||||
|
||||
|
|
@ -1065,7 +1067,7 @@ static int esp_node_detach(struct ieee80211_hw *hw, u8 ifidx, const u8 *addr)
|
|||
struct esp_node * esp_get_node_by_addr(struct esp_pub * epub, const u8 *addr)
|
||||
{
|
||||
int i;
|
||||
u8 map;
|
||||
u32 map;
|
||||
struct esp_node *node = NULL;
|
||||
if(addr == NULL)
|
||||
return NULL;
|
||||
|
|
@ -1093,6 +1095,27 @@ struct esp_node * esp_get_node_by_addr(struct esp_pub * epub, const u8 *addr)
|
|||
return node;
|
||||
}
|
||||
|
||||
struct esp_node * esp_get_node_by_index(struct esp_pub * epub, u8 index)
|
||||
{
|
||||
u32 map;
|
||||
struct esp_node *node = NULL;
|
||||
|
||||
if (epub == NULL)
|
||||
return NULL;
|
||||
|
||||
spin_lock_bh(&epub->tx_ampdu_lock);
|
||||
map = epub->enodes_map;
|
||||
if (map & BIT(index)) {
|
||||
node = epub->enodes[index];
|
||||
} else {
|
||||
spin_unlock_bh(&epub->tx_ampdu_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
spin_unlock_bh(&epub->tx_ampdu_lock);
|
||||
return node;
|
||||
}
|
||||
|
||||
int esp_get_empty_rxampdu(struct esp_pub * epub, const u8 *addr, u8 tid)
|
||||
{
|
||||
int index = -1;
|
||||
|
|
@ -2172,14 +2195,25 @@ esp_pub_init_mac80211(struct esp_pub *epub)
|
|||
int
|
||||
esp_register_mac80211(struct esp_pub *epub)
|
||||
{
|
||||
int ret = 0;
|
||||
int ret = 0;
|
||||
u8 mac[ETH_ALEN];
|
||||
#ifdef P2P_CONCURRENT
|
||||
u8 *wlan_addr;
|
||||
u8 *p2p_addr;
|
||||
int idx;
|
||||
#endif
|
||||
|
||||
esp_pub_init_mac80211(epub);
|
||||
esp_pub_init_mac80211(epub);
|
||||
|
||||
printk("Wifi Efuse Mac => %02x:%02x:%02x:%02x:%02x:%02x\n", epub->mac_addr[0], epub->mac_addr[1],
|
||||
epub->mac_addr[2], epub->mac_addr[3], epub->mac_addr[4], epub->mac_addr[5]);
|
||||
|
||||
if (!rockchip_wifi_mac_addr(mac))
|
||||
{
|
||||
printk("=========> get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
|
||||
mac[2], mac[3], mac[4], mac[5]);
|
||||
memcpy(epub->mac_addr, mac, ETH_ALEN);
|
||||
}
|
||||
|
||||
#ifdef P2P_CONCURRENT
|
||||
epub->hw->wiphy->addresses = (struct mac_address *)esp_mac_addr;
|
||||
|
|
|
|||
28
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/esp_mac80211.h
Executable file
28
drivers/net/wireless/rockchip_wlan/esp8089/esp_driver/esp_mac80211.h
Executable file
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2014 Espressif System.
|
||||
*
|
||||
* MAC80211 support module
|
||||
*/
|
||||
#ifndef _ESP_MAC80211_H_
|
||||
#define _ESP_MAC80211_H_
|
||||
|
||||
struct esp_80211_wmm_ac_param {
|
||||
u8 aci_aifsn; /* AIFSN, ACM, ACI */
|
||||
u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
|
||||
u16 txop_limit;
|
||||
};
|
||||
|
||||
struct esp_80211_wmm_param_element {
|
||||
/* Element ID: 221 (0xdd); length: 24 */
|
||||
/* required fields for WMM version 1 */
|
||||
u8 oui[3]; /* 00:50:f2 */
|
||||
u8 oui_type; /* 2 */
|
||||
u8 oui_subtype; /* 1 */
|
||||
u8 version; /* 1 for WMM version 1.0 */
|
||||
u8 qos_info; /* AP/STA specif QoS info */
|
||||
u8 reserved; /* 0 */
|
||||
struct esp_80211_wmm_ac_param ac[4]; /* AC_BE, AC_BK, AC_VI, AC_VO */
|
||||
};
|
||||
|
||||
|
||||
#endif /* _ESP_MAC80211_H_ */
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2010 - 2012 Espressif System.
|
||||
* Copyright (c) 2010 - 2014 Espressif System.
|
||||
*
|
||||
* main routine
|
||||
*/
|
||||
|
||||
#include <linux/netdevice.h>
|
||||
|
|
@ -16,12 +18,8 @@
|
|||
#include "esp_sip.h"
|
||||
#include "esp_sif.h"
|
||||
#include "esp_debug.h"
|
||||
#ifdef ANDROID
|
||||
#include "esp_android.h"
|
||||
#endif /* ANDROID */
|
||||
#include "esp_file.h"
|
||||
#include "esp_wl.h"
|
||||
#include "slc_host_register.h"
|
||||
#include "esp_android.h"
|
||||
|
||||
struct completion *gl_bootup_cplx = NULL;
|
||||
|
||||
|
|
@ -29,11 +27,11 @@ struct completion *gl_bootup_cplx = NULL;
|
|||
static int esp_download_fw(struct esp_pub * epub);
|
||||
#endif /* !FGPA_DEBUG */
|
||||
|
||||
static bool modparam_no_txampdu = false;
|
||||
static bool modparam_no_rxampdu = false;
|
||||
module_param_named(no_txampdu, modparam_no_txampdu, bool, 0444);
|
||||
static int modparam_no_txampdu = 0;
|
||||
static int modparam_no_rxampdu = 0;
|
||||
module_param_named(no_txampdu, modparam_no_txampdu, int, 0444);
|
||||
MODULE_PARM_DESC(no_txampdu, "Disable tx ampdu.");
|
||||
module_param_named(no_rxampdu, modparam_no_rxampdu, bool, 0444);
|
||||
module_param_named(no_rxampdu, modparam_no_rxampdu, int, 0444);
|
||||
MODULE_PARM_DESC(no_rxampdu, "Disable rx ampdu.");
|
||||
|
||||
static char *modparam_eagle_path = "";
|
||||
|
|
@ -79,18 +77,16 @@ int esp_pub_init_all(struct esp_pub *epub)
|
|||
|
||||
esp_dump_var("esp_msg_level", NULL, &esp_msg_level, ESP_U32);
|
||||
|
||||
#if defined(ANDROID) && defined (ESP_ANDROID_LOGGER)
|
||||
#ifdef ESP_ANDROID_LOGGER
|
||||
esp_dump_var("log_off", NULL, &log_off, ESP_U32);
|
||||
#endif /* ESP_ANDROID_LOGGER */
|
||||
|
||||
ret = sip_prepare_boot(epub->sip);
|
||||
if (ret)
|
||||
return ret;
|
||||
} else {
|
||||
atomic_set(&epub->sip->state, SIP_PREPARE_BOOT);
|
||||
atomic_set(&epub->sip->tx_credits, 0);
|
||||
}
|
||||
|
||||
epub->sip->to_host_seq = 0;
|
||||
|
||||
#ifdef TEST_MODE
|
||||
if(sif_get_ate_config() != 0 && sif_get_ate_config() != 1 && sif_get_ate_config() !=6 )
|
||||
{
|
||||
|
|
@ -123,14 +119,11 @@ int esp_pub_init_all(struct esp_pub *epub)
|
|||
|
||||
esp_dbg(ESP_DBG_TRACE, "download firmware OK \n");
|
||||
#else
|
||||
#ifndef SDIO_TEST
|
||||
sip_send_bootup(epub->sip);
|
||||
#endif /* !SDIO_TEST */
|
||||
|
||||
#endif /* FPGA_DEBUG */
|
||||
|
||||
gl_bootup_cplx = &complete;
|
||||
epub->wait_reset = 0;
|
||||
epub->wait_reset = 0;
|
||||
sif_enable_irq(epub);
|
||||
|
||||
if(epub->sdio_state == ESP_SDIO_STATE_SECOND_INIT || sif_get_ate_config() == 1){
|
||||
|
|
@ -153,37 +146,6 @@ int esp_pub_init_all(struct esp_pub *epub)
|
|||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void esp_ps_config(struct esp_pub *epub, struct esp_ps *ps, bool on)
|
||||
{
|
||||
unsigned long time = jiffies - ps->last_config_time;
|
||||
u32 time_msec = jiffies_to_msecs(time);
|
||||
|
||||
ps->last_config_time = jiffies;
|
||||
|
||||
if (on && (atomic_read(&ps->state) == ESP_PM_TURNING_ON || atomic_read(&ps->state) == ESP_PM_ON)) {
|
||||
esp_dbg(ESP_DBG_PS, "%s same state\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
ps->nulldata_pm_on = false;
|
||||
|
||||
esp_dbg(ESP_DBG_PS, "%s PS %s, dtim %u maxslp %u period %u\n", __func__, on?"ON":"OFF", ps->dtim_period, ps->max_sleep_period, time_msec);
|
||||
|
||||
//NB: turn on ps may need additional check, make sure don't hurt iperf downlink since pkt may be sparse during rx
|
||||
|
||||
if (on) {
|
||||
esp_dbg(ESP_DBG_PS, "%s ps state %d => turning ON\n", __func__, atomic_read(&ps->state));
|
||||
atomic_set(&ps->state, ESP_PM_TURNING_ON);
|
||||
} else {
|
||||
esp_dbg(ESP_DBG_PS, "%s ps state %d => turning OFF\n", __func__, atomic_read(&ps->state));
|
||||
atomic_set(&ps->state, ESP_PM_TURNING_OFF);
|
||||
}
|
||||
|
||||
sip_send_ps_config(epub, ps);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
esp_dsr(struct esp_pub *epub)
|
||||
{
|
||||
|
|
@ -205,6 +167,7 @@ struct esp_fw_blk_hdr {
|
|||
|
||||
#define ESP_FW_NAME1 "eagle_fw1.bin"
|
||||
#define ESP_FW_NAME2 "eagle_fw2.bin"
|
||||
#define ESP_FW_NAME3 "eagle_fw3.bin"
|
||||
|
||||
#ifndef FPGA_DEBUG
|
||||
static int esp_download_fw(struct esp_pub * epub)
|
||||
|
|
@ -222,24 +185,19 @@ static int esp_download_fw(struct esp_pub * epub)
|
|||
|
||||
#ifndef HAS_FW
|
||||
|
||||
char * esp_fw_name = epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT ? ESP_FW_NAME1 : ESP_FW_NAME2;
|
||||
|
||||
#ifdef ANDROID
|
||||
ret = android_request_firmware(&fw_entry, esp_fw_name, epub->dev);
|
||||
#else
|
||||
ret = request_firmware(&fw_entry, esp_fw_name, epub->dev);
|
||||
#endif //ANDROID
|
||||
if(sif_get_ate_config() == 1) {
|
||||
char * esp_fw_name = ESP_FW_NAME3;
|
||||
} else {
|
||||
char * esp_fw_name = epub->sdio_state == ESP_SDIO_STATE_FIRST_INIT ? ESP_FW_NAME1 : ESP_FW_NAME2;
|
||||
}
|
||||
ret = esp_request_firmware(&fw_entry, esp_fw_name, epub->dev);
|
||||
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
fw_buf = kmemdup(fw_entry->data, fw_entry->size, GFP_KERNEL);
|
||||
|
||||
#ifdef ANDROID
|
||||
android_release_firmware(fw_entry);
|
||||
#else
|
||||
release_firmware(fw_entry);
|
||||
#endif //ANDROID
|
||||
esp_release_firmware(fw_entry);
|
||||
|
||||
if (fw_buf == NULL) {
|
||||
return -ENOMEM;
|
||||
|
|
|
|||
|
|
@ -1,14 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2012 Espressif System
|
||||
*/
|
||||
|
||||
#ifndef _ESP_OS_H_
|
||||
#define _ESP_OS_H_
|
||||
|
||||
#ifndef __packed
|
||||
#define __packed __attribute__ ((packed))
|
||||
#endif /* __packed */
|
||||
|
||||
#include "net/mac80211.h"
|
||||
|
||||
#endif /*__ESP_OS_H_*/
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2010 -2013 Espressif System.
|
||||
* Copyright (c) 2010 -2014 Espressif System.
|
||||
*
|
||||
* power save control of system
|
||||
*/
|
||||
#ifdef CONFIG_HAS_WAKELOCK
|
||||
#include <linux/wakelock.h>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2012 Espressif System.
|
||||
* Copyright (c) 2011-2014 Espressif System.
|
||||
*
|
||||
* wlan device header file
|
||||
*/
|
||||
|
|
@ -23,25 +23,25 @@
|
|||
|
||||
enum esp_sdio_state{
|
||||
ESP_SDIO_STATE_FIRST_INIT,
|
||||
ESP_SDIO_STATE_FIRST_NORMAL_EXIT,
|
||||
ESP_SDIO_STATE_FIRST_ERROR_EXIT,
|
||||
ESP_SDIO_STATE_SECOND_INIT,
|
||||
ESP_SDIO_STATE_SECOND_ERROR_EXIT,
|
||||
ESP_SDIO_STATE_FIRST_NORMAL_EXIT,
|
||||
ESP_SDIO_STATE_FIRST_ERROR_EXIT,
|
||||
ESP_SDIO_STATE_SECOND_INIT,
|
||||
ESP_SDIO_STATE_SECOND_ERROR_EXIT,
|
||||
};
|
||||
|
||||
enum esp_tid_state {
|
||||
ESP_TID_STATE_INIT,
|
||||
ESP_TID_STATE_TRIGGER,
|
||||
ESP_TID_STATE_PROGRESS,
|
||||
ESP_TID_STATE_OPERATIONAL,
|
||||
ESP_TID_STATE_WAIT_STOP,
|
||||
ESP_TID_STATE_STOP,
|
||||
ESP_TID_STATE_INIT,
|
||||
ESP_TID_STATE_TRIGGER,
|
||||
ESP_TID_STATE_PROGRESS,
|
||||
ESP_TID_STATE_OPERATIONAL,
|
||||
ESP_TID_STATE_WAIT_STOP,
|
||||
ESP_TID_STATE_STOP,
|
||||
};
|
||||
|
||||
struct esp_tx_tid {
|
||||
u8 state;
|
||||
u8 state;
|
||||
u8 cnt;
|
||||
u16 ssn;
|
||||
u16 ssn;
|
||||
};
|
||||
|
||||
#define WME_NUM_TID 16
|
||||
|
|
@ -51,9 +51,9 @@ struct esp_node {
|
|||
struct ieee80211_sta *sta;
|
||||
#else
|
||||
u8 addr[ETH_ALEN];
|
||||
u16 aid;
|
||||
u64 supp_rates[IEEE80211_NUM_BANDS];
|
||||
struct ieee80211_ht_info ht_info;
|
||||
u16 aid;
|
||||
u64 supp_rates[IEEE80211_NUM_BANDS];
|
||||
struct ieee80211_ht_info ht_info;
|
||||
#endif
|
||||
u8 ifidx;
|
||||
u8 index;
|
||||
|
|
@ -87,33 +87,14 @@ struct esp_vif {
|
|||
};*/
|
||||
|
||||
typedef struct esp_wl {
|
||||
u8 ssid[IEEE80211_MAX_SSID_LEN];
|
||||
u8 dot11_auth_mode;
|
||||
u8 auth_mode;
|
||||
u8 prwise_crypto;
|
||||
u8 prwise_crypto_len;
|
||||
u8 grp_crypto;
|
||||
u8 grp_crpto_len;
|
||||
u8 def_txkey_index;
|
||||
u32 used_key_entries; //each bit represent an entry, 0: avail 1: used
|
||||
|
||||
u8 bssid[ETH_ALEN];
|
||||
u8 req_bssid[ETH_ALEN];
|
||||
u16 ch_hint;
|
||||
u16 bss_ch;
|
||||
u16 listen_intvl_b;
|
||||
u16 listen_intvl_t;
|
||||
|
||||
//struct hw_scan_timeout *hsd;
|
||||
struct cfg80211_scan_request *scan_req;
|
||||
atomic_t ptk_cnt;
|
||||
atomic_t gtk_cnt;
|
||||
atomic_t tkip_key_set;
|
||||
//struct ieee80211_key_conf *ptk;
|
||||
//struct ieee80211_key_conf *gtk[4];
|
||||
|
||||
struct list_head amsdu_rx_buffer_queue;
|
||||
struct timer_list disconnect_timer;
|
||||
|
||||
/* so far only 2G band */
|
||||
struct ieee80211_supported_band sbands[IEEE80211_NUM_BANDS];
|
||||
|
|
@ -127,9 +108,6 @@ typedef struct esp_hw_idx_map {
|
|||
u8 flag;
|
||||
} esp_hw_idx_map_t;
|
||||
|
||||
#define ESP_TXQ_MAX_LEN 64 /* TBD: better #? */
|
||||
#define ESP_PUB_F_TXPAUSE 0x1
|
||||
|
||||
#define ESP_WL_FLAG_RFKILL BIT(0)
|
||||
#define ESP_WL_FLAG_HW_REGISTERED BIT(1)
|
||||
#define ESP_WL_FLAG_CONNECT BIT(2)
|
||||
|
|
@ -154,6 +132,11 @@ struct esp_ps {
|
|||
bool nulldata_pm_on;
|
||||
};
|
||||
|
||||
struct esp_mac_prefix {
|
||||
u8 mac_index;
|
||||
u8 mac_addr_prefix[3];
|
||||
};
|
||||
|
||||
struct esp_pub {
|
||||
struct device *dev;
|
||||
#ifdef ESP_NO_MAC80211
|
||||
|
|
@ -172,7 +155,7 @@ struct esp_pub {
|
|||
struct esp_wl wl;
|
||||
struct esp_hw_idx_map hi_map[19];
|
||||
struct esp_hw_idx_map low_map[ESP_PUB_MAX_VIF][2];
|
||||
u32 flags; //flags to represent rfkill switch,start
|
||||
//u32 flags; //flags to represent rfkill switch,start
|
||||
u8 roc_flags; //0: not in remain on channel state, 1: in roc state
|
||||
|
||||
struct work_struct tx_work; /* attach to ieee80211 workqueue */
|
||||
|
|
@ -191,16 +174,16 @@ struct esp_pub {
|
|||
|
||||
struct workqueue_struct *esp_wkq;
|
||||
|
||||
u8 bssid[ETH_ALEN];
|
||||
//u8 bssid[ETH_ALEN];
|
||||
u8 mac_addr[ETH_ALEN];
|
||||
|
||||
u32 rx_filter;
|
||||
unsigned long scan_permit;
|
||||
bool scan_permit_valid;
|
||||
struct delayed_work scan_timeout_work;
|
||||
u8 enodes_map;
|
||||
u32 enodes_map;
|
||||
u8 rxampdu_map;
|
||||
u8 enodes_maps[ESP_PUB_MAX_VIF];
|
||||
u32 enodes_maps[ESP_PUB_MAX_VIF];
|
||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 28))
|
||||
struct esp_node nodes[ESP_PUB_MAX_STA + 1];
|
||||
#endif
|
||||
|
|
@ -208,8 +191,8 @@ struct esp_pub {
|
|||
struct esp_node * rxampdu_node[ESP_PUB_MAX_RXAMPDU];
|
||||
u8 rxampdu_tid[ESP_PUB_MAX_RXAMPDU];
|
||||
struct esp_ps ps;
|
||||
int enable_int;
|
||||
int wait_reset;
|
||||
int enable_int;
|
||||
int wait_reset;
|
||||
};
|
||||
|
||||
typedef struct esp_pub esp_pub_t;
|
||||
|
|
@ -236,6 +219,7 @@ void esp_wakelock_destroy(void);
|
|||
void esp_wake_lock(void);
|
||||
void esp_wake_unlock(void);
|
||||
struct esp_node * esp_get_node_by_addr(struct esp_pub * epub, const u8 *addr);
|
||||
struct esp_node * esp_get_node_by_index(struct esp_pub * epub, u8 index);
|
||||
int esp_get_empty_rxampdu(struct esp_pub * epub, const u8 *addr, u8 tid);
|
||||
int esp_get_exist_rxampdu(struct esp_pub * epub, const u8 *addr, u8 tid);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011 - 2013 Espressif System.
|
||||
* Copyright (c) 2011 - 2014 Espressif System.
|
||||
*
|
||||
* Serial I/F wrapper layer for eagle WLAN device,
|
||||
* abstraction of buses like SDIO/SIP, and provides
|
||||
|
|
@ -20,19 +20,6 @@
|
|||
|
||||
#define SIF_SLC_BLOCK_SIZE 512
|
||||
|
||||
#define SIF_DMA_BUFFER_SIZE (64 * 1024)
|
||||
|
||||
/* to make the last byte located at :xffff, increase 1 byte here */
|
||||
//#define SIF_SLC_WINDOW_END_ADDR (0xffff + 1)
|
||||
//#define SIF_SLC_WINDOW_END_ADDR (0x1ffff + 1 - 0x800)
|
||||
|
||||
#define SIF_MAX_SCATTER_REQUESTS 4
|
||||
#define SIF_MAX_SCATTER_ENTRIES_PER_REQ 16
|
||||
#define SIF_MAX_SCATTER_REQ_TRANSFER_SIZE (32 * 1024)
|
||||
|
||||
|
||||
/* SIF bus request */
|
||||
#define SIF_REQ_MAX_NUM 64
|
||||
|
||||
/* S/W struct mapping to slc registers */
|
||||
typedef struct slc_host_regs {
|
||||
|
|
@ -56,18 +43,6 @@ typedef struct slc_host_regs {
|
|||
} sif_slc_reg_t;
|
||||
|
||||
|
||||
struct sif_req {
|
||||
struct list_head list;
|
||||
|
||||
u32 address;
|
||||
|
||||
u8 *buffer;
|
||||
u32 length;
|
||||
u32 flag;
|
||||
int status;
|
||||
void * context;
|
||||
};
|
||||
|
||||
enum io_sync_type {
|
||||
ESP_SIF_NOSYNC = 0,
|
||||
ESP_SIF_SYNC,
|
||||
|
|
@ -84,7 +59,6 @@ typedef struct esp_spi_ctrl {
|
|||
|
||||
|
||||
struct list_head free_req;
|
||||
struct sif_req reqs[SIF_REQ_MAX_NUM];
|
||||
|
||||
u8 *dma_buffer;
|
||||
|
||||
|
|
@ -113,15 +87,15 @@ typedef struct esp_spi_ctrl {
|
|||
|
||||
#ifdef ESP_USE_SPI
|
||||
struct esp_spi_resp {
|
||||
u32 max_dataW_resp_size;
|
||||
u32 max_dataR_resp_size;
|
||||
u32 max_block_dataW_resp_size;
|
||||
u32 max_block_dataR_resp_size;
|
||||
u32 max_cmd_resp_size;
|
||||
u32 data_resp_size_w;
|
||||
u32 data_resp_size_r;
|
||||
u32 block_w_data_resp_size_final;
|
||||
u32 block_r_data_resp_size_final;
|
||||
u32 max_dataW_resp_size;
|
||||
u32 max_dataR_resp_size;
|
||||
u32 max_block_dataW_resp_size;
|
||||
u32 max_block_dataR_resp_size;
|
||||
u32 max_cmd_resp_size;
|
||||
u32 data_resp_size_w;
|
||||
u32 data_resp_size_r;
|
||||
u32 block_w_data_resp_size_final;
|
||||
u32 block_r_data_resp_size_final;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
@ -202,16 +176,6 @@ struct esp_spi_resp {
|
|||
#define EPUB_TO_FUNC(_epub) (((struct esp_spi_ctrl *)(_epub)->sif)->spi)
|
||||
#endif
|
||||
|
||||
static void inline sif_setup_req(struct sif_req *req, u32 addr, u32 flag, u32 len,
|
||||
u8 * buf, void *context)
|
||||
{
|
||||
req->address = addr;
|
||||
req->flag = flag;
|
||||
req->length = len;
|
||||
req->buffer = buf;
|
||||
req->context = context;
|
||||
}
|
||||
|
||||
void sdio_io_writeb(struct esp_pub *epub, u8 value, int addr, int *res);
|
||||
u8 sdio_io_readb(struct esp_pub *epub, int addr, int *res);
|
||||
|
||||
|
|
@ -246,17 +210,17 @@ void sif_platform_register_board_info(void);
|
|||
#endif
|
||||
|
||||
void sif_dsr(struct spi_device *spi);
|
||||
int sif_spi_read_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_epub_read_mix_sync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_epub_read_mix_nosync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_read_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_read_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode, bool noround,int reg_window);
|
||||
int sif_spi_read_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_epub_read_mix_sync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_epub_read_mix_nosync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_read_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_read_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode, bool noround);
|
||||
|
||||
int sif_spi_write_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_epub_write_mix_sync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_epub_write_mix_nosync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_write_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_write_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode,int reg_window);
|
||||
int sif_spi_write_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_epub_write_mix_sync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_epub_write_mix_nosync(struct esp_pub *epub, unsigned int addr,unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_write_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode);
|
||||
int sif_spi_write_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode);
|
||||
|
||||
int sif_platform_get_irq_no(void);
|
||||
int sif_platform_is_irq_occur(void);
|
||||
|
|
@ -264,9 +228,7 @@ void sif_platform_irq_clear(void);
|
|||
void sif_platform_irq_mask(int enable_mask);
|
||||
int sif_platform_irq_init(void);
|
||||
void sif_platform_irq_deinit(void);
|
||||
#endif
|
||||
|
||||
#ifdef ESP_USE_SPI
|
||||
int sif_spi_write_bytes(struct spi_device *spi, unsigned int addr,unsigned char *dst, int count, int check_idle);
|
||||
int sif_spi_read_bytes(struct spi_device *spi, unsigned int addr,unsigned char *dst, int count, int check_idle);
|
||||
struct esp_spi_resp *sif_get_spi_resp(void);
|
||||
|
|
@ -280,6 +242,11 @@ int esp_common_write_with_addr(struct esp_pub *epub, u32 addr, u8 *buf, u32 len,
|
|||
int esp_common_readbyte_with_addr(struct esp_pub *epub, u32 addr, u8 *buf, int sync);
|
||||
int esp_common_writebyte_with_addr(struct esp_pub *epub, u32 addr, u8 buf, int sync);
|
||||
|
||||
int sif_read_reg_window(struct esp_pub *epub, unsigned int reg_addr, unsigned char *value);
|
||||
int sif_write_reg_window(struct esp_pub *epub, unsigned int reg_addr, unsigned char *value);
|
||||
int sif_ack_target_read_err(struct esp_pub *epub);
|
||||
int sif_had_io_enable(struct esp_pub *epub);
|
||||
|
||||
struct slc_host_regs * sif_get_regs(struct esp_pub *epub);
|
||||
|
||||
void sif_lock_bus(struct esp_pub *epub);
|
||||
|
|
@ -300,7 +267,6 @@ int sif_get_gpio_intr(struct esp_pub *epub, u16 intr_mask, u16 *value);
|
|||
int sif_get_gpio_input(struct esp_pub *epub, u16 *mask, u16 *value);
|
||||
#endif
|
||||
|
||||
void sif_raw_dummy_read(struct esp_pub *epub,int ext_gpio);
|
||||
void check_target_id(struct esp_pub *epub);
|
||||
|
||||
void sif_record_bt_config(int value);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2009- 2012 Espressif System.
|
||||
* Copyright (c) 2009- 2014 Espressif System.
|
||||
*
|
||||
* Serial Interconnctor Protocol
|
||||
*/
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
|
||||
#include "sip2_common.h"
|
||||
|
||||
#define SIP_CTRL_CREDIT_RESERVE 2
|
||||
|
||||
#define SIP_PKT_MAX_LEN (1024*16)
|
||||
|
||||
/* 16KB on normal X86 system, should check before porting to orhters */
|
||||
|
|
@ -24,18 +26,18 @@ struct sip_pkt {
|
|||
u8 * buf_begin;
|
||||
u32 buf_len;
|
||||
u8 * buf;
|
||||
u32 payload_len;
|
||||
#if 0
|
||||
union {
|
||||
struct sip_tx_pkt_info tx;
|
||||
struct sip_rx_pkt_info rx;
|
||||
} info;
|
||||
#endif
|
||||
void *context;
|
||||
int status;
|
||||
//void (* completion)(struct esp_sip *sip, struct sip_pkt *pkt);
|
||||
};
|
||||
|
||||
typedef enum RECALC_CREDIT_STATE {
|
||||
RECALC_CREDIT_DISABLE = 0,
|
||||
RECALC_CREDIT_ENABLE = 1,
|
||||
} RECALC_CREDIT_STATE;
|
||||
|
||||
typedef enum ENQUEUE_PRIOR {
|
||||
ENQUEUE_PRIOR_TAIL = 0,
|
||||
ENQUEUE_PRIOR_HEAD,
|
||||
} ENQUEUE_PRIOR;
|
||||
|
||||
typedef enum SIP_STATE {
|
||||
SIP_INIT = 0,
|
||||
SIP_PREPARE_BOOT,
|
||||
|
|
@ -62,9 +64,10 @@ struct esp_sip {
|
|||
u32 txseq;
|
||||
u32 txdataseq;
|
||||
|
||||
u8 to_host_seq;
|
||||
|
||||
atomic_t state;
|
||||
spinlock_t lock;
|
||||
int boot_credits;
|
||||
atomic_t tx_credits;
|
||||
|
||||
atomic_t tx_ask_credit_update;
|
||||
|
|
@ -73,17 +76,10 @@ struct esp_sip {
|
|||
u8 * tx_aggr_buf;
|
||||
u8 * tx_aggr_write_ptr; /* update after insertion of each pkt */
|
||||
u8 * tx_aggr_lastpkt_ptr;
|
||||
#if 0
|
||||
u8 * rx_aggr_buf;
|
||||
u8 * rx_aggr_write_ptr;
|
||||
u8 * rx_aggr_lastpkt_ptr;
|
||||
#endif
|
||||
|
||||
struct mutex rx_mtx;
|
||||
struct sk_buff_head rxq;
|
||||
#ifndef RX_SYNC
|
||||
struct work_struct rx_process_work;
|
||||
#endif/* RX_SYNC */
|
||||
|
||||
u16 tx_blksz;
|
||||
u16 rx_blksz;
|
||||
|
|
@ -94,6 +90,9 @@ struct esp_sip {
|
|||
bool support_bgscan;
|
||||
u8 credit_to_reserve;
|
||||
|
||||
atomic_t credit_status;
|
||||
struct timer_list credit_timer;
|
||||
|
||||
atomic_t noise_floor;
|
||||
|
||||
u32 tx_tot_len; /* total len for one transaction */
|
||||
|
|
@ -115,17 +114,11 @@ struct esp_sip {
|
|||
int sip_rx(struct esp_pub * epub);
|
||||
//int sip_download_fw(struct esp_sip *sip, u32 load_addr, u32 boot_addr);
|
||||
|
||||
/* tx must pad as 4-byte aligned */
|
||||
int sip_tx(struct esp_pub * epub, struct sip_pkt *pkt);
|
||||
|
||||
int sip_get_raw_credits(struct esp_sip *);
|
||||
|
||||
int sip_write_memory(struct esp_sip *, u32 addr, u8* buf, u16 len);
|
||||
|
||||
void sip_credit_process(struct esp_pub *, u8 credits);
|
||||
|
||||
int sip_prepare_boot(struct esp_sip *sip);
|
||||
|
||||
int sip_send_cmd(struct esp_sip *sip, int cid, u32 cmdlen, void * cmd);
|
||||
|
||||
struct esp_sip * sip_attach(struct esp_pub *);
|
||||
|
|
@ -148,9 +141,7 @@ bool sip_tx_data_may_resume(struct esp_sip *sip);
|
|||
void sip_tx_data_pkt_enqueue(struct esp_pub *epub, struct sk_buff *skb);
|
||||
void sip_rx_data_pkt_enqueue(struct esp_pub *epub, struct sk_buff *skb);
|
||||
|
||||
int sip_cmd_enqueue(struct esp_sip *sip, struct sk_buff *skb);
|
||||
|
||||
void sip_dump_pending_data(struct esp_pub *epub);
|
||||
int sip_cmd_enqueue(struct esp_sip *sip, struct sk_buff *skb, int prior);
|
||||
|
||||
int sip_poll_bootup_event(struct esp_sip *sip);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2012 Espressif System.
|
||||
* Copyright (c) 2009 - 2014 Espressif System.
|
||||
*/
|
||||
|
||||
#include "linux/types.h"
|
||||
|
|
@ -20,8 +20,7 @@
|
|||
/*
|
||||
* Convert IEEE channel number to MHz frequency.
|
||||
*/
|
||||
u32
|
||||
esp_ieee2mhz(u8 chan)
|
||||
u32 esp_ieee2mhz(u8 chan)
|
||||
{
|
||||
if (chan == 14)
|
||||
return 2484;
|
||||
|
|
@ -30,6 +29,7 @@ esp_ieee2mhz(u8 chan)
|
|||
return 2407 + chan*5;
|
||||
else
|
||||
return 2512 + ((chan-15)*20);
|
||||
//TODO, add 5GHz
|
||||
}
|
||||
enum {
|
||||
ESP_RATE_1_LONG = 0x0,
|
||||
|
|
@ -71,7 +71,7 @@ static u8 esp_rate_table[20] = {
|
|||
ESP_RATE_36,
|
||||
ESP_RATE_48,
|
||||
ESP_RATE_54,
|
||||
/* ESP_RATE_MCS0,
|
||||
/* ESP_RATE_MCS0,
|
||||
ESP_RATE_MCS1,
|
||||
ESP_RATE_MCS2,
|
||||
ESP_RATE_MCS3,
|
||||
|
|
@ -86,17 +86,17 @@ s8 esp_wmac_rate2idx(u8 rate)
|
|||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (rate == esp_rate_table[i])
|
||||
return i;
|
||||
}
|
||||
|
||||
if (rate == ESP_RATE_2_LONG)
|
||||
return 1;
|
||||
if (rate == ESP_RATE_5_LONG)
|
||||
return 2;
|
||||
if (rate == ESP_RATE_11_LONG)
|
||||
return 3;
|
||||
|
||||
for (i = 0; i < 20; i++) {
|
||||
if (rate == esp_rate_table[i])
|
||||
return i;
|
||||
}
|
||||
|
||||
esp_dbg(ESP_DBG_ERROR,"%s unknown rate 0x%02x \n", __func__, rate);
|
||||
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
#define DRIVER_VER 0x6272c30af2c8ll
|
||||
#define DRIVER_VER 0xbdf5087c3debll
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010 -2013 Espressif System.
|
||||
* Copyright (c) 2010 -2014 Espressif System.
|
||||
*
|
||||
* sdio serial i/f driver
|
||||
* - sdio device control routines
|
||||
|
|
@ -27,16 +27,13 @@
|
|||
#include "slc_host_register.h"
|
||||
#include "esp_version.h"
|
||||
#include "esp_ctrl.h"
|
||||
#ifdef ANDROID
|
||||
#include "esp_android.h"
|
||||
#endif /* ANDROID */
|
||||
#include "esp_file.h"
|
||||
#ifdef USE_EXT_GPIO
|
||||
#include "esp_ext.h"
|
||||
#endif /* USE_EXT_GPIO */
|
||||
|
||||
|
||||
static int esp_sdio_init(void);
|
||||
static void esp_sdio_exit(void);
|
||||
static int /*__init */ esp_sdio_init(void);
|
||||
static void /* __exit */ esp_sdio_exit(void);
|
||||
|
||||
|
||||
#define ESP_DMA_IBUFSZ 2048
|
||||
|
|
@ -58,8 +55,6 @@ static int esdio_power_on(struct esp_sdio_ctrl *sctrl);
|
|||
|
||||
void sif_set_clock(struct sdio_func *func, int clk);
|
||||
|
||||
struct sif_req * sif_alloc_req(struct esp_sdio_ctrl *sctrl);
|
||||
|
||||
#include "sdio_stub.c"
|
||||
|
||||
void sif_lock_bus(struct esp_pub *epub)
|
||||
|
|
@ -80,54 +75,6 @@ void sif_unlock_bus(struct esp_pub *epub)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef SDIO_TEST
|
||||
static void sif_test_tx(struct esp_sdio_ctrl *sctrl)
|
||||
{
|
||||
int i, err = 0;
|
||||
|
||||
for (i = 0; i < 500; i++) {
|
||||
sctrl->dma_buffer[i] = i;
|
||||
}
|
||||
|
||||
sdio_claim_host(sctrl->func);
|
||||
err = sdio_memcpy_toio(sctrl->func, 0x10001 - 500, sctrl->dma_buffer, 500);
|
||||
sif_platform_check_r1_ready(sctrl->epub);
|
||||
sdio_release_host(sctrl->func);
|
||||
|
||||
esp_dbg(ESP_DBG, "%s toio err %d\n", __func__, err);
|
||||
}
|
||||
|
||||
static void sif_test_dsr(struct sdio_func *func)
|
||||
{
|
||||
struct esp_sdio_ctrl *sctrl = sdio_get_drvdata(func);
|
||||
|
||||
sdio_release_host(sctrl->func);
|
||||
|
||||
/* no need to read out registers in normal operation any more */
|
||||
//sif_io_sync(sctrl->epub, SIF_SLC_WINDOW_END_ADDR - 64, sctrl->dma_buffer, 64, SIF_FROM_DEVICE | SIF_INC_ADDR | SIF_SYNC | SIF_BYTE_BASIS);
|
||||
//
|
||||
esp_dsr(sctrl->epub);
|
||||
|
||||
sdio_claim_host(func);
|
||||
|
||||
//show_buf(sctrl->dma_buffer, 64);
|
||||
}
|
||||
|
||||
void sif_test_rx(struct esp_sdio_ctrl *sctrl)
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
sdio_claim_host(sctrl->func);
|
||||
|
||||
err = sdio_claim_irq(sctrl->func, sif_test_dsr);
|
||||
|
||||
if (err)
|
||||
esp_dbg(ESP_DBG_ERROR, "sif %s failed\n", __func__);
|
||||
|
||||
sdio_release_host(sctrl->func);
|
||||
}
|
||||
#endif //SDIO_TEST
|
||||
|
||||
static inline bool bad_buf(u8 * buf)
|
||||
{
|
||||
return ((unsigned long) buf & 0x3) || !virt_addr_valid(buf);
|
||||
|
|
@ -632,10 +579,6 @@ static int esp_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i
|
|||
|
||||
sdio_release_host(func);
|
||||
|
||||
#ifdef SDIO_TEST
|
||||
sif_test_tx(sctrl);
|
||||
#else
|
||||
|
||||
#ifdef LOWER_CLK
|
||||
/* fix clock for dongle */
|
||||
sif_set_clock(func, 23);
|
||||
|
|
@ -653,7 +596,6 @@ static int esp_sdio_probe(struct sdio_func *func, const struct sdio_device_id *i
|
|||
goto _err_second_init;
|
||||
}
|
||||
|
||||
#endif //SDIO_TEST
|
||||
esp_dbg(ESP_DBG_TRACE, " %s return %d\n", __func__, err);
|
||||
if(sif_sdio_state == ESP_SDIO_STATE_FIRST_INIT){
|
||||
esp_dbg(ESP_DBG_ERROR, "first normal exit\n");
|
||||
|
|
@ -693,6 +635,8 @@ static void esp_sdio_remove(struct sdio_func *func)
|
|||
{
|
||||
struct esp_sdio_ctrl *sctrl = NULL;
|
||||
|
||||
esp_dbg(ESP_SHOW, "%s enter\n", __func__);
|
||||
|
||||
sctrl = sdio_get_drvdata(func);
|
||||
|
||||
if (sctrl == NULL) {
|
||||
|
|
@ -840,7 +784,7 @@ static struct sdio_driver esp_sdio_dummy_driver = {
|
|||
.remove = esp_sdio_dummy_remove,
|
||||
};
|
||||
|
||||
static int esp_sdio_init(void)
|
||||
static int /*__init */ esp_sdio_init(void)
|
||||
{
|
||||
#define ESP_WAIT_UP_TIME_MS 11000
|
||||
int err;
|
||||
|
|
@ -857,9 +801,7 @@ static int esp_sdio_init(void)
|
|||
#endif
|
||||
edf_ret = esp_debugfs_init();
|
||||
|
||||
#ifdef ANDROID
|
||||
android_request_init_conf();
|
||||
#endif /* defined(ANDROID)*/
|
||||
request_init_conf();
|
||||
|
||||
esp_wakelock_init();
|
||||
esp_wake_lock();
|
||||
|
|
@ -944,9 +886,9 @@ static int esp_sdio_init(void)
|
|||
return err;
|
||||
}
|
||||
|
||||
static void esp_sdio_exit(void)
|
||||
static void /*__exit*/ esp_sdio_exit(void)
|
||||
{
|
||||
esp_dbg(ESP_DBG_TRACE, "%s \n", __func__);
|
||||
esp_dbg(ESP_SHOW, "%s \n", __func__);
|
||||
|
||||
esp_debugfs_exit();
|
||||
|
||||
|
|
@ -963,7 +905,6 @@ static void esp_sdio_exit(void)
|
|||
esp_wakelock_destroy();
|
||||
}
|
||||
|
||||
|
||||
MODULE_AUTHOR("Espressif System");
|
||||
MODULE_DESCRIPTION("Driver for SDIO interconnected eagle low-power WLAN devices");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ extern int rockchip_wifi_set_carddetect(int val);
|
|||
extern int rk29sdk_wifi_power(int on);
|
||||
extern int rk29sdk_wifi_set_carddetect(int val);
|
||||
|
||||
#if 1
|
||||
|
||||
int rockchip_wifi_init_module_esp8089(void)
|
||||
{
|
||||
|
||||
|
|
@ -30,7 +30,7 @@ void rockchip_wifi_exit_module_esp8089(void)
|
|||
esp_sdio_exit();
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void sif_platform_rescan_card(unsigned insert)
|
||||
{
|
||||
//rk29sdk_wifi_set_carddetect(insert); libing
|
||||
|
|
@ -79,7 +79,7 @@ void sif_platform_target_poweron(void)
|
|||
printk("=======================================================\n");
|
||||
printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n");
|
||||
printk("=======================================================\n");
|
||||
printk("Espressif ESP8089 SDIO WiFi driver (Powered by Rockchip,Ver %s) init.\n", ESP8089_DRV_VERSION);
|
||||
printk("Espressif ESP8089 SDIO WiFi driver (Powered by Rockchip,Ver1.9(11272014),Drv: %s) init.\n", ESP8089_DRV_VERSION);
|
||||
|
||||
if(sif_get_bt_config() == 1){
|
||||
sif_platform_reset_target();
|
||||
|
|
@ -119,5 +119,4 @@ void sif_platform_ack_interrupt(struct esp_pub *epub)
|
|||
EXPORT_SYMBOL(rockchip_wifi_init_module_esp8089);
|
||||
EXPORT_SYMBOL(rockchip_wifi_exit_module_esp8089);
|
||||
|
||||
//module_init(esp_sdio_init);
|
||||
//module_exit(esp_sdio_exit);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2010 - 2012 Espressif System.
|
||||
* Copyright (c) 2010 - 2014 Espressif System.
|
||||
*
|
||||
* Common definitions of Serial Interconnctor Protocol
|
||||
*
|
||||
|
|
@ -56,6 +56,7 @@ enum sip_cmd_id {
|
|||
SIP_CMD_PS,
|
||||
SIP_CMD_ATE,
|
||||
SIP_CMD_SUSPEND,
|
||||
SIP_CMD_RECALC_CREDIT,
|
||||
SIP_CMD_MAX,
|
||||
};
|
||||
|
||||
|
|
@ -453,7 +454,7 @@ struct sip_cmd_debug {
|
|||
|
||||
struct sip_evt_debug {
|
||||
u16 len;
|
||||
u32 results[8];
|
||||
u32 results[12];
|
||||
u16 pad;
|
||||
} __packed;
|
||||
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@
|
|||
/* #define REG_SLC_HOST_BASE 0x00000000 */
|
||||
/* skip the token1, since reading it will clean the credit */
|
||||
#define REG_SLC_HOST_BASE 0x00000000
|
||||
#define REG_SLC_BASE 0x00000000
|
||||
|
||||
|
||||
#define SLC_HOST_PF (REG_SLC_HOST_BASE + 0x0)
|
||||
|
|
@ -218,6 +219,8 @@
|
|||
#define SLC_HOST_CONF20 0x000000FF
|
||||
#define SLC_HOST_CONF20_S 0
|
||||
|
||||
#define SLC_HOST_WIN_CMD (REG_SLC_HOST_BASE + 0x40)
|
||||
|
||||
|
||||
#define SLC_HOST_DATE (REG_SLC_HOST_BASE + 0x78)
|
||||
#define SLC_HOST_ID (REG_SLC_HOST_BASE + 0x7C)
|
||||
|
|
@ -238,5 +241,22 @@
|
|||
(v) |= SLC_TO_HOST_ADDR_WINDOW; \
|
||||
} while (0);
|
||||
|
||||
#define SLC_INT_ENA (REG_SLC_BASE + 0xC)
|
||||
#define SLC_RX_EOF_INT_ENA BIT(17)
|
||||
#define SLC_FRHOST_BIT2_INT_ENA BIT(2)
|
||||
|
||||
#define SLC_RX_LINK (REG_SLC_BASE + 0x24)
|
||||
#define SLC_RXLINK_START BIT(29)
|
||||
|
||||
#define SLC_BRIDGE_CONF (REG_SLC_BASE + 0x44)
|
||||
#define SLC_TX_PUSH_IDLE_NUM 0xFFFF
|
||||
#define SLC_TX_PUSH_IDLE_NUM_S 16
|
||||
#define SLC_HDA_MAP_128K BIT(13)
|
||||
#define SLC_TX_DUMMY_MODE BIT(12)
|
||||
#define SLC_FIFO_MAP_ENA 0x0000000F
|
||||
#define SLC_FIFO_MAP_ENA_S 8
|
||||
#define SLC_TXEOF_ENA 0x0000003F
|
||||
#define SLC_TXEOF_ENA_S
|
||||
|
||||
|
||||
#endif // SLC_HOST_REGISTER_H_INCLUDED
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2010 -2013 Espressif System.
|
||||
* Copyright (c) 2010 -2014 Espressif System.
|
||||
*
|
||||
* sdio serial i/f driver
|
||||
* spi serial i/f driver
|
||||
* - sdio device control routines
|
||||
* - sync/async DMA/PIO read/write
|
||||
*
|
||||
|
|
@ -24,15 +24,18 @@
|
|||
#include "slc_host_register.h"
|
||||
#include "esp_version.h"
|
||||
#include "esp_ctrl.h"
|
||||
#ifdef ANDROID
|
||||
#include "esp_android.h"
|
||||
#endif /* ANDROID */
|
||||
#include "esp_file.h"
|
||||
#ifdef USE_EXT_GPIO
|
||||
#include "esp_ext.h"
|
||||
#endif /* USE_EXT_GPIO */
|
||||
|
||||
static int esp_spi_init(void);
|
||||
static void esp_spi_exit(void);
|
||||
static int /*__init */ esp_spi_init(void);
|
||||
static void /* __exit */ esp_spi_exit(void);
|
||||
|
||||
#ifdef ESP_PREALLOC
|
||||
extern u8 *esp_get_lspi_buf(void);
|
||||
extern void esp_put_lspi_buf(u8 **p);
|
||||
#endif
|
||||
|
||||
#define SPI_BLOCK_SIZE (512)
|
||||
|
||||
|
|
@ -115,7 +118,6 @@ bool log_off = false;
|
|||
#ifdef REQUEST_RTC_IRQ
|
||||
extern int request_rtc_irq(void);
|
||||
#endif
|
||||
struct sif_req * sif_alloc_req(struct esp_spi_ctrl *sctrl);
|
||||
|
||||
#include "spi_stub.c"
|
||||
|
||||
|
|
@ -157,48 +159,6 @@ int sif_spi_write_then_read(struct spi_device *spi, unsigned char* bufwrite, int
|
|||
return 0;
|
||||
}
|
||||
|
||||
int sif_spi_read_reg_window(struct spi_device *spi, unsigned int reg_addr, unsigned char *value)
|
||||
{
|
||||
int ret = 0;
|
||||
int retry = 20;
|
||||
|
||||
if(reg_addr > 0x1f)
|
||||
return -1;
|
||||
|
||||
check_buf[0] = 0x80 | (reg_addr & 0x1f);
|
||||
|
||||
ret = sif_spi_write_bytes(spi, 0x40,check_buf , 1, NOT_DUMMYMODE);
|
||||
|
||||
if(ret == 0)
|
||||
{
|
||||
do{
|
||||
if(retry < 20)
|
||||
mdelay(10);
|
||||
retry --;
|
||||
ret = sif_spi_read_bytes(spi, 0xc, check_buf, 4, NOT_DUMMYMODE);
|
||||
}while(retry >0 && ret != 0);
|
||||
}
|
||||
|
||||
if(ret ==0)
|
||||
memcpy(value,check_buf,4);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sif_spi_write_reg_window(struct spi_device *spi, unsigned int reg_addr,unsigned char *value)
|
||||
{
|
||||
int ret = 0;
|
||||
|
||||
if(reg_addr > 0x1f)
|
||||
return -1;
|
||||
memcpy(check_buf,value,4);
|
||||
check_buf[4] = 0xc0 |(reg_addr & 0x1f);
|
||||
|
||||
ret = sif_spi_write_bytes(spi, 0x3c,check_buf , 5, NOT_DUMMYMODE);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
int sif_spi_write_async_read(struct spi_device *spi, unsigned char* bufwrite,unsigned char* bufread,int size)
|
||||
{
|
||||
struct spi_transfer xfer = {
|
||||
|
|
@ -769,49 +729,43 @@ int sif_spi_write_blocks(struct spi_device *spi, unsigned int addr,unsigned char
|
|||
return err_ret;
|
||||
}
|
||||
|
||||
int sif_spi_write_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode,int reg_window)
|
||||
int sif_spi_write_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
int blk_cnt;
|
||||
int remain_len;
|
||||
int err;
|
||||
if(reg_window == 0)
|
||||
{
|
||||
blk_cnt = len/SPI_BLOCK_SIZE;
|
||||
remain_len = len%SPI_BLOCK_SIZE;
|
||||
int blk_cnt;
|
||||
int remain_len;
|
||||
int err;
|
||||
do {
|
||||
blk_cnt = len/SPI_BLOCK_SIZE;
|
||||
remain_len = len%SPI_BLOCK_SIZE;
|
||||
|
||||
if (blk_cnt > 0) {
|
||||
err = sif_spi_write_blocks(spi, addr, buf, blk_cnt);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
if (blk_cnt > 0) {
|
||||
err = sif_spi_write_blocks(spi, addr, buf, blk_cnt);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if (remain_len > 0) {
|
||||
err = sif_spi_write_bytes(spi, addr, (buf + (blk_cnt*SPI_BLOCK_SIZE)), remain_len, dummymode);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
}else
|
||||
{
|
||||
err =sif_spi_write_reg_window(spi,addr,buf);
|
||||
if(err)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
if (remain_len > 0) {
|
||||
err = sif_spi_write_bytes(spi, addr, (buf + (blk_cnt*SPI_BLOCK_SIZE)), remain_len, dummymode);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
} while(0);
|
||||
return 0;
|
||||
|
||||
}
|
||||
|
||||
int sif_spi_write_mix_sync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode,int reg_window)
|
||||
int sif_spi_write_mix_sync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
int err;
|
||||
|
||||
spi_bus_lock(spi->master);
|
||||
err = sif_spi_write_mix_nosync(spi, addr, buf, len, dummymode,reg_window);
|
||||
err = sif_spi_write_mix_nosync(spi, addr, buf, len, dummymode);
|
||||
spi_bus_unlock(spi->master);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int sif_spi_epub_write_mix_nosync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode,int reg_window)
|
||||
int sif_spi_epub_write_mix_nosync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -827,10 +781,10 @@ int sif_spi_epub_write_mix_nosync(struct esp_pub *epub, unsigned int addr, unsig
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return sif_spi_write_mix_nosync(spi, addr, buf, len, dummymode,reg_window);
|
||||
return sif_spi_write_mix_nosync(spi, addr, buf, len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_epub_write_mix_sync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode,int reg_window)
|
||||
int sif_spi_epub_write_mix_sync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -846,7 +800,7 @@ int sif_spi_epub_write_mix_sync(struct esp_pub *epub, unsigned int addr, unsigne
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return sif_spi_write_mix_sync(spi, addr, buf, len, dummymode,reg_window);
|
||||
return sif_spi_write_mix_sync(spi, addr, buf, len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_read_bytes(struct spi_device *spi, unsigned int addr,unsigned char *dst, int count, int dummymode)
|
||||
|
|
@ -1285,94 +1239,88 @@ int sif_spi_read_blocks(struct spi_device *spi, unsigned int addr, unsigned char
|
|||
return err_ret;
|
||||
}
|
||||
|
||||
int sif_spi_read_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode,int reg_window)
|
||||
int sif_spi_read_mix_nosync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
int blk_cnt;
|
||||
int remain_len;
|
||||
int err = 0;
|
||||
int retry = 20;
|
||||
int err = 0;
|
||||
int retry = 20;
|
||||
|
||||
if(reg_window == 0)
|
||||
{
|
||||
blk_cnt = len/SPI_BLOCK_SIZE;
|
||||
remain_len = len%SPI_BLOCK_SIZE;
|
||||
do{
|
||||
blk_cnt = len/SPI_BLOCK_SIZE;
|
||||
remain_len = len%SPI_BLOCK_SIZE;
|
||||
|
||||
if (blk_cnt > 0) {
|
||||
if (blk_cnt > 0) {
|
||||
|
||||
retry = 20;
|
||||
do {
|
||||
if(retry < 20)
|
||||
mdelay(10);
|
||||
retry--;
|
||||
check_buf[0] = 1<<2;
|
||||
err = sif_spi_read_blocks(spi, addr, buf, blk_cnt);
|
||||
if(err == 0)
|
||||
{
|
||||
sif_spi_write_bytes(spi,SLC_HOST_CONF_W4 + 2,check_buf,1,0);
|
||||
} else if(err == -4 ||err == -5 ||err == -6||err == -7 ||err == -8)
|
||||
{
|
||||
sif_spi_read_reg_window(spi, 0x9, check_buf);
|
||||
check_buf[3] = check_buf[3] | (1<<5);
|
||||
sif_spi_write_reg_window(spi,0x9, check_buf);
|
||||
} else if(err == -3)
|
||||
{
|
||||
continue;
|
||||
} else
|
||||
{
|
||||
break;
|
||||
}
|
||||
retry = 20;
|
||||
do {
|
||||
if(retry < 20)
|
||||
mdelay(10);
|
||||
retry--;
|
||||
check_buf[0] = 1<<2;
|
||||
err = sif_spi_read_blocks(spi, addr, buf, blk_cnt);
|
||||
if(err == 0)
|
||||
{
|
||||
sif_spi_write_bytes(spi,SLC_HOST_CONF_W4 + 2,check_buf,1,0);
|
||||
} else if(err == -4 ||err == -5 ||err == -6||err == -7 ||err == -8)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = spi_get_drvdata(spi);
|
||||
if(sctrl != NULL) {
|
||||
sif_ack_target_read_err(sctrl->epub);
|
||||
}
|
||||
} else if(err == -3)
|
||||
{
|
||||
continue;
|
||||
} else
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
}while(retry > 0 && err != 0);
|
||||
if(err != 0 && retry == 0)
|
||||
esp_dbg(ESP_DBG_ERROR, "spierr 20 times retry block read fail\n");
|
||||
|
||||
if(err)
|
||||
return err;
|
||||
}
|
||||
}while(retry > 0 && err != 0);
|
||||
if(err != 0 && retry == 0)
|
||||
esp_dbg(ESP_DBG_ERROR, "spierr 20 times retry block read fail\n");
|
||||
|
||||
if (remain_len > 0) {
|
||||
if(dummymode == 0 )
|
||||
{
|
||||
retry = 20;
|
||||
do{
|
||||
if(retry <20)
|
||||
mdelay(10);
|
||||
retry--;
|
||||
err = sif_spi_read_bytes(spi, addr, (buf + (blk_cnt*SPI_BLOCK_SIZE)), remain_len, dummymode);
|
||||
}while(retry >0 && err != 0);
|
||||
if(err)
|
||||
return err;
|
||||
}
|
||||
|
||||
if(err != 0 && retry == 0)
|
||||
esp_dbg(ESP_DBG_ERROR, "spierr 20 times retry byte read fail\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
err = sif_spi_read_bytes(spi, addr, (buf + (blk_cnt*SPI_BLOCK_SIZE)), remain_len, dummymode);
|
||||
}
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
err =sif_spi_read_reg_window(spi,addr,buf);
|
||||
if(err)
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
if (remain_len > 0) {
|
||||
if(dummymode == 0 )
|
||||
{
|
||||
retry = 20;
|
||||
do{
|
||||
if(retry <20)
|
||||
mdelay(10);
|
||||
retry--;
|
||||
err = sif_spi_read_bytes(spi, addr, (buf + (blk_cnt*SPI_BLOCK_SIZE)), remain_len, dummymode);
|
||||
}while(retry >0 && err != 0);
|
||||
|
||||
if(err != 0 && retry == 0)
|
||||
esp_dbg(ESP_DBG_ERROR, "spierr 20 times retry byte read fail\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
err = sif_spi_read_bytes(spi, addr, (buf + (blk_cnt*SPI_BLOCK_SIZE)), remain_len, dummymode);
|
||||
}
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
} while(0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int sif_spi_read_mix_sync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode, int reg_window)
|
||||
int sif_spi_read_mix_sync(struct spi_device *spi, unsigned int addr, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
int err;
|
||||
|
||||
spi_bus_lock(spi->master);
|
||||
err = sif_spi_read_mix_nosync(spi, addr, buf, len, dummymode,reg_window);
|
||||
err = sif_spi_read_mix_nosync(spi, addr, buf, len, dummymode);
|
||||
spi_bus_unlock(spi->master);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
int sif_spi_epub_read_mix_nosync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode, int reg_window)
|
||||
int sif_spi_epub_read_mix_nosync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -1388,10 +1336,10 @@ int sif_spi_epub_read_mix_nosync(struct esp_pub *epub, unsigned int addr, unsign
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return sif_spi_read_mix_nosync(spi, addr, buf, len, dummymode,reg_window);
|
||||
return sif_spi_read_mix_nosync(spi, addr, buf, len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_epub_read_mix_sync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode,int reg_window)
|
||||
int sif_spi_epub_read_mix_sync(struct esp_pub *epub, unsigned int addr, unsigned char *buf,int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -1407,10 +1355,10 @@ int sif_spi_epub_read_mix_sync(struct esp_pub *epub, unsigned int addr, unsigned
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
return sif_spi_read_mix_sync(spi, addr, buf, len, dummymode,reg_window);
|
||||
return sif_spi_read_mix_sync(spi, addr, buf, len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_read_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode,int reg_window)
|
||||
int sif_spi_read_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -1439,10 +1387,10 @@ int sif_spi_read_sync(struct esp_pub *epub, unsigned char *buf, int len, int dum
|
|||
break;
|
||||
}
|
||||
|
||||
return sif_spi_read_mix_sync(spi, sctrl->slc_window_end_addr - 2 - (len), buf, read_len, dummymode,reg_window);
|
||||
return sif_spi_read_mix_sync(spi, sctrl->slc_window_end_addr - 2 - (len), buf, read_len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_write_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode,int reg_window)
|
||||
int sif_spi_write_sync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -1470,10 +1418,10 @@ int sif_spi_write_sync(struct esp_pub *epub, unsigned char *buf, int len, int du
|
|||
write_len = len;
|
||||
break;
|
||||
}
|
||||
return sif_spi_write_mix_sync(spi, sctrl->slc_window_end_addr - (len), buf, write_len, dummymode,reg_window);
|
||||
return sif_spi_write_mix_sync(spi, sctrl->slc_window_end_addr - (len), buf, write_len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_read_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode, bool noround,int reg_window)
|
||||
int sif_spi_read_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode, bool noround)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -1505,10 +1453,10 @@ int sif_spi_read_nosync(struct esp_pub *epub, unsigned char *buf, int len, int d
|
|||
break;
|
||||
}
|
||||
|
||||
return sif_spi_read_mix_nosync(spi, sctrl->slc_window_end_addr - 2 - (len), buf, read_len, dummymode,reg_window);
|
||||
return sif_spi_read_mix_nosync(spi, sctrl->slc_window_end_addr - 2 - (len), buf, read_len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_write_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode,int reg_window)
|
||||
int sif_spi_write_nosync(struct esp_pub *epub, unsigned char *buf, int len, int dummymode)
|
||||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
struct spi_device *spi = NULL;
|
||||
|
|
@ -1536,7 +1484,7 @@ int sif_spi_write_nosync(struct esp_pub *epub, unsigned char *buf, int len, int
|
|||
write_len = len;
|
||||
break;
|
||||
}
|
||||
return sif_spi_write_mix_nosync(spi, sctrl->slc_window_end_addr - (len), buf, write_len, dummymode,reg_window);
|
||||
return sif_spi_write_mix_nosync(spi, sctrl->slc_window_end_addr - (len), buf, write_len, dummymode);
|
||||
}
|
||||
|
||||
int sif_spi_protocol_init(struct spi_device *spi)
|
||||
|
|
@ -1943,14 +1891,25 @@ void sif_disable_irq(struct esp_pub *epub)
|
|||
|
||||
int esp_setup_spi(struct spi_device *spi)
|
||||
{
|
||||
#ifndef ESP_PREALLOC
|
||||
int retry = 10;
|
||||
#endif
|
||||
/**** alloc buffer for spi io */
|
||||
if (sif_sdio_state == ESP_SDIO_STATE_FIRST_INIT) {
|
||||
if ((buf_addr = (unsigned char *)kmalloc (MAX_BUF_SIZE, GFP_KERNEL)) == NULL)
|
||||
return -ENOMEM;
|
||||
#ifdef ESP_PREALLOC
|
||||
if ((buf_addr = esp_get_lspi_buf()) == NULL)
|
||||
goto _err_buf_addr;
|
||||
#else
|
||||
while ((buf_addr = (unsigned char *)kmalloc (MAX_BUF_SIZE, GFP_KERNEL)) == NULL) {
|
||||
if (--retry < 0)
|
||||
goto _err_buf_addr;
|
||||
}
|
||||
#endif
|
||||
if ((check_buf = (unsigned char *)kmalloc (256, GFP_KERNEL)) == NULL)
|
||||
return -ENOMEM;
|
||||
goto _err_check_buf;
|
||||
|
||||
if ((ff_buf = (unsigned char *)kmalloc (256, GFP_KERNEL)) == NULL)
|
||||
return -ENOMEM;
|
||||
goto _err_ff_buf;
|
||||
|
||||
memset(ff_buf,0xff,256);
|
||||
|
||||
|
|
@ -1974,14 +1933,25 @@ int esp_setup_spi(struct spi_device *spi)
|
|||
spi_resp.block_w_data_resp_size_final = 1000;
|
||||
spi_resp.block_r_data_resp_size_final = 1000;
|
||||
}
|
||||
#if 0
|
||||
spi->mode = 0x03;
|
||||
spi->bits_per_word = 8;
|
||||
spi->max_speed_hz = SPI_FREQ;
|
||||
|
||||
return spi_setup(spi);
|
||||
#endif
|
||||
return 0;
|
||||
|
||||
_err_ff_buf:
|
||||
if (check_buf) {
|
||||
kfree(check_buf);
|
||||
check_buf = NULL;
|
||||
}
|
||||
_err_check_buf:
|
||||
if (buf_addr) {
|
||||
#ifdef ESP_PREALLOC
|
||||
esp_put_lspi_buf(&buf_addr);
|
||||
#else
|
||||
kfree(buf_addr);
|
||||
#endif
|
||||
buf_addr = NULL;
|
||||
}
|
||||
_err_buf_addr:
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -2071,9 +2041,6 @@ static int esp_spi_probe(struct spi_device *spi)
|
|||
}
|
||||
check_target_id(epub);
|
||||
|
||||
#ifdef SDIO_TEST
|
||||
sif_test_tx(sctrl);
|
||||
#else
|
||||
err = esp_pub_init_all(epub);
|
||||
|
||||
if (err) {
|
||||
|
|
@ -2086,7 +2053,6 @@ static int esp_spi_probe(struct spi_device *spi)
|
|||
goto _err_second_init;
|
||||
}
|
||||
|
||||
#endif //SDIO_TEST
|
||||
esp_dbg(ESP_DBG_TRACE, " %s return %d\n", __func__, err);
|
||||
if(sif_sdio_state == ESP_SDIO_STATE_FIRST_INIT){
|
||||
esp_dbg(ESP_DBG_ERROR, "first normal exit\n");
|
||||
|
|
@ -2108,7 +2074,11 @@ static int esp_spi_probe(struct spi_device *spi)
|
|||
kfree(sctrl);
|
||||
_err_spi:
|
||||
if (buf_addr) {
|
||||
#ifdef ESP_PREALLOC
|
||||
esp_put_lspi_buf(&buf_addr);
|
||||
#else
|
||||
kfree(buf_addr);
|
||||
#endif
|
||||
buf_addr = NULL;
|
||||
tx_cmd = NULL;
|
||||
rx_cmd = NULL;
|
||||
|
|
@ -2139,6 +2109,8 @@ static int esp_spi_remove(struct spi_device *spi)
|
|||
{
|
||||
struct esp_spi_ctrl *sctrl = NULL;
|
||||
|
||||
esp_dbg(ESP_SHOW, "%s \n", __func__);
|
||||
|
||||
sctrl = spi_get_drvdata(spi);
|
||||
|
||||
if (sctrl == NULL) {
|
||||
|
|
@ -2184,7 +2156,11 @@ static int esp_spi_remove(struct spi_device *spi)
|
|||
kfree(sctrl);
|
||||
|
||||
if (buf_addr) {
|
||||
#ifdef ESP_PREALLOC
|
||||
esp_put_lspi_buf(&buf_addr);
|
||||
#else
|
||||
kfree(buf_addr);
|
||||
#endif
|
||||
buf_addr = NULL;
|
||||
rx_cmd = NULL;
|
||||
tx_cmd = NULL;
|
||||
|
|
@ -2297,9 +2273,7 @@ static int __init esp_spi_init(void)
|
|||
#endif
|
||||
edf_ret = esp_debugfs_init();
|
||||
|
||||
#ifdef ANDROID
|
||||
android_request_init_conf();
|
||||
#endif /* defined(ANDROID)*/
|
||||
request_init_conf();
|
||||
|
||||
esp_wakelock_init();
|
||||
esp_wake_lock();
|
||||
|
|
@ -2380,7 +2354,7 @@ static int __init esp_spi_init(void)
|
|||
|
||||
static void __exit esp_spi_exit(void)
|
||||
{
|
||||
esp_dbg(ESP_DBG_TRACE, "%s \n", __func__);
|
||||
esp_dbg(ESP_SHOW, "%s \n", __func__);
|
||||
|
||||
esp_debugfs_exit();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/*
|
||||
* Copyright (c) 2011 Espressif System.
|
||||
* Copyright (c) 2011-2014 Espressif System.
|
||||
*
|
||||
* MAC80211 support module
|
||||
* test mode
|
||||
*/
|
||||
|
||||
#ifdef TEST_MODE
|
||||
|
||||
#include <linux/kernel.h>
|
||||
|
|
@ -27,10 +27,13 @@
|
|||
#include "esp_wl.h"
|
||||
#include "testmode.h"
|
||||
#include "esp_path.h"
|
||||
#include "esp_file.h"
|
||||
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 31))
|
||||
#include <net/regulatory.h>
|
||||
#endif
|
||||
|
||||
static int queue_flag = 0;
|
||||
|
||||
static u32 connected_nl;
|
||||
static struct genl_info info_copy;
|
||||
static struct esp_sip *sip_copy = NULL;
|
||||
|
|
@ -80,7 +83,10 @@ void inc_loopback_id()
|
|||
|
||||
static void sip_send_test_cmd(struct esp_sip *sip, struct sk_buff *skb)
|
||||
{
|
||||
skb_queue_tail(&sip->epub->txq, skb);
|
||||
if (queue_flag == 0)
|
||||
skb_queue_tail(&sip->epub->txq, skb);
|
||||
else
|
||||
skb_queue_head(&sip->epub->txq, skb);
|
||||
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 32)
|
||||
if(sif_get_ate_config() == 0){
|
||||
|
|
@ -151,6 +157,15 @@ static int esp_test_echo(struct sk_buff *skb_2,
|
|||
/*get echo info*/
|
||||
echo_info = nla_data(info->attrs[TEST_ATTR_STR]);
|
||||
|
||||
if (strncmp(echo_info, "queue_head", 10) == 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "echo : change to queue head");
|
||||
queue_flag = 1;
|
||||
}
|
||||
if (strncmp(echo_info, "queue_tail", 10) == 0) {
|
||||
esp_dbg(ESP_DBG_ERROR, "echo : change to queue head");
|
||||
queue_flag = 0;
|
||||
}
|
||||
|
||||
res=esp_test_cmd_reply(info, TEST_CMD_ECHO, echo_info);
|
||||
return res;
|
||||
out:
|
||||
|
|
@ -1100,26 +1115,26 @@ void esp_stability_test(char *filename,struct esp_pub *epub)
|
|||
sprintf(test_res_str, "error, count = %d !!!\n", count);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
goto _out;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_request_init_conf();
|
||||
#endif
|
||||
|
||||
request_init_conf();
|
||||
|
||||
if(sif_get_ate_config() == 0)
|
||||
{
|
||||
|
||||
sprintf(test_res_str, "ok, count = %d !!!\n", count);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
goto _out;
|
||||
}
|
||||
|
||||
|
|
@ -1129,9 +1144,9 @@ void esp_stability_test(char *filename,struct esp_pub *epub)
|
|||
sprintf(test_res_str, "error, count = %d !!!\n", count);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
goto _out;
|
||||
}
|
||||
|
||||
|
|
@ -1140,9 +1155,8 @@ void esp_stability_test(char *filename,struct esp_pub *epub)
|
|||
|
||||
sprintf(test_res_str, "ok, count = %d !!!\n", count);
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
_out:
|
||||
kfree(rx_buf);
|
||||
|
|
@ -1198,9 +1212,9 @@ void esp_rate_test(char *filename,struct esp_pub *epub)
|
|||
sprintf(test_res_str, "ok,rw_time=%lu,read_time=%lu,write_time=%lu !!!\n",test_time_rw,test_time_read,test_time_write);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
kfree(tx_buf);
|
||||
kfree(rx_buf);
|
||||
}
|
||||
|
|
@ -1274,9 +1288,9 @@ void esp_resp_test(char *filename,struct esp_pub *epub)
|
|||
sprintf(test_res_str, "error, count = %d !!!\n", count);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
goto _out;
|
||||
}
|
||||
}
|
||||
|
|
@ -1300,9 +1314,9 @@ void esp_resp_test(char *filename,struct esp_pub *epub)
|
|||
sprintf(test_res_str, "error, count = %d !!!\n", count);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
goto _out;
|
||||
}
|
||||
}
|
||||
|
|
@ -1317,9 +1331,8 @@ void esp_resp_test(char *filename,struct esp_pub *epub)
|
|||
spi_resp->max_dataW_resp_size,spi_resp->max_dataR_resp_size,spi_resp->max_block_dataW_resp_size,spi_resp->max_block_dataR_resp_size,spi_resp->max_cmd_resp_size);
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
_out:
|
||||
kfree(rx_buf);
|
||||
|
|
@ -1377,9 +1390,9 @@ void esp_noisefloor_test(char *filename,struct esp_pub *epub)
|
|||
}
|
||||
|
||||
printk("%s\n", test_res_str);
|
||||
#if defined(ANDROID) && defined(ESP_ANDROID_LOGGER)
|
||||
android_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
#endif
|
||||
|
||||
esp_readwrite_file(filename, NULL, test_res_str, strlen(test_res_str));
|
||||
|
||||
kfree(res_buf);
|
||||
kfree(tx_buf);
|
||||
kfree(rx_buf);
|
||||
|
|
@ -1387,7 +1400,6 @@ void esp_noisefloor_test(char *filename,struct esp_pub *epub)
|
|||
|
||||
void esp_test_init(struct esp_pub *epub)
|
||||
{
|
||||
char *buf = kzalloc(64, GFP_KERNEL);
|
||||
char filename[256];
|
||||
|
||||
if (mod_eagle_path_get() == NULL)
|
||||
|
|
@ -1395,46 +1407,9 @@ void esp_test_init(struct esp_pub *epub)
|
|||
else
|
||||
sprintf(filename, "%s/%s", mod_eagle_path_get(), "test_results");
|
||||
|
||||
esp_common_read_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
buf[3]=0x91;
|
||||
esp_common_write_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
esp_common_read_with_addr((epub), 0x3c, buf, 64, ESP_SIF_SYNC);
|
||||
buf[0]=0x3f;
|
||||
esp_common_write_with_addr((epub), 0x3c, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x3c, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
esp_common_read_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
buf[0]=0x34;
|
||||
esp_common_write_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
esp_common_read_with_addr((epub), 0x3e, buf, 64, ESP_SIF_SYNC);
|
||||
buf[0]=0xfe;
|
||||
esp_common_write_with_addr((epub), 0x3e, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x3e, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
esp_common_read_with_addr((epub), 0x3f, buf, 64, ESP_SIF_SYNC);
|
||||
buf[0]=0x00;
|
||||
esp_common_write_with_addr((epub), 0x3f, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x3f, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
esp_common_read_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
buf[3]=0xd1;
|
||||
esp_common_write_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x3d, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
esp_common_read_with_addr((epub), 0x29, buf, 64, ESP_SIF_SYNC);
|
||||
buf[0]=0x30;
|
||||
esp_common_write_with_addr((epub), 0x29, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x29, buf, 64, ESP_SIF_SYNC);
|
||||
|
||||
//set w3 0
|
||||
esp_common_read_with_addr((epub), 0x24, buf, 64, ESP_SIF_SYNC);
|
||||
buf[0]=0x1;
|
||||
esp_common_write_with_addr((epub), 0x24, buf, 64, ESP_SIF_SYNC);
|
||||
esp_common_read_with_addr((epub), 0x24, buf, 64, ESP_SIF_SYNC);
|
||||
sif_lock_bus(epub);
|
||||
sif_had_io_enable(epub);
|
||||
sif_unlock_bus(epub);
|
||||
|
||||
if(sif_get_ate_config() == 2){
|
||||
esp_stability_test(filename,epub);
|
||||
|
|
@ -1450,7 +1425,6 @@ void esp_test_init(struct esp_pub *epub)
|
|||
else if(sif_get_ate_config() == 6){
|
||||
esp_noisefloor_test(filename,epub);
|
||||
}
|
||||
kfree(buf);
|
||||
}
|
||||
|
||||
#endif //ifdef TEST_MODE
|
||||
|
|
|
|||
|
|
@ -40,6 +40,24 @@ enum {
|
|||
#define TEST_ATTR_MAX (__TEST_ATTR_MAX - 1)
|
||||
#define TEST_ATTR_PARA(i) (TEST_ATTR_PARA0+(i))
|
||||
|
||||
enum {
|
||||
RD_REG = 0,
|
||||
WR_REG,
|
||||
SET_SENSE,
|
||||
SET_TX_RATE,
|
||||
SET_TX_FREQ,
|
||||
TKIP_MIC_ERROR,
|
||||
RIFS_CTRL,
|
||||
BACKOFF,
|
||||
SET_RXSENSE,
|
||||
CONFIGURE_TRC,
|
||||
RDPER,
|
||||
RDRSSI,
|
||||
DBGTRC,
|
||||
WRMEM,
|
||||
RDMEM
|
||||
};
|
||||
|
||||
u32 get_loopback_num(void);
|
||||
u32 get_loopback_id(void);
|
||||
void inc_loopback_id(void);
|
||||
|
|
|
|||
|
|
@ -2,8 +2,14 @@
|
|||
|
||||
DRIVER_NAME := esp_prealloc
|
||||
|
||||
EXTRA_CFLAGS += -DESP_PRE_MEM
|
||||
####################### NORMAL OPTION ########################################
|
||||
EXTRA_CFLAGS += -DESP_PRE_MEM # normal mode, support SDIO
|
||||
#EXTRA_CFLAGS += -DESP_PRE_MEM -DESP_SPI # normal mode, support SPI
|
||||
##############################################################################
|
||||
|
||||
####################### ADVANCE OPTION ###########################
|
||||
#EXTRA_CFLAGS += -DESP_SLAB # ex mode, most users unlikely use this mode, if someone use, please add this macro extractly
|
||||
##############################################################################
|
||||
obj-y:= $(DRIVER_NAME).o
|
||||
$(DRIVER_NAME)-y += esp_mem.o
|
||||
$(DRIVER_NAME)-y += esp_slab.o
|
||||
|
|
|
|||
16
drivers/net/wireless/rockchip_wlan/esp8089/esp_premalloc/README
Executable file
16
drivers/net/wireless/rockchip_wlan/esp8089/esp_premalloc/README
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
###################### ESP_PREALLOC ##########################
|
||||
NOTICE:
|
||||
|
||||
If you use a low-memory pad/tv-box or other machines which based on ESP8089,
|
||||
you may need this program.
|
||||
|
||||
When some low-memory(normally less than 512MB) machine boot up, more android application
|
||||
will run, so remain memory may be a lttle less, in this case, you may run this
|
||||
program in the period when linux kernel boot. This program may pre-alloc enough
|
||||
memory, then ESP8089 driver will get memory from ESP_PREALLOC rather than kernel
|
||||
call such as kmalloc.
|
||||
|
||||
We suggest you use built-in of esp_prealloc, not *.ko. But the "Makefile" in the tgz
|
||||
package is base on *.ko", so you may alter the makefile to fit your built-in environment.
|
||||
|
||||
You can get the detail use case is in the <<esp8089_release_v1.xx.pdf>>.
|
||||
|
|
@ -9,6 +9,10 @@
|
|||
#include "esp_mem.h"
|
||||
#include "esp_log.h"
|
||||
|
||||
#ifdef ESP_SPI
|
||||
static u8 *gl_lspi_buf;
|
||||
#endif
|
||||
|
||||
static u8 *gl_tx_aggr_buf;
|
||||
|
||||
static struct esp_skb_elem gl_sip_skb_arr[SIP_SKB_ARR_NUM];
|
||||
|
|
@ -84,7 +88,7 @@ EXPORT_SYMBOL(esp_pre_sip_skb_show);
|
|||
struct sk_buff *esp_get_sip_skb(int size)
|
||||
{
|
||||
int i;
|
||||
int retry = 10;
|
||||
int retry = 100;
|
||||
|
||||
do {
|
||||
if (size <= SIP_SKB_SIZE_8K) {
|
||||
|
|
@ -116,7 +120,7 @@ struct sk_buff *esp_get_sip_skb(int size)
|
|||
break;
|
||||
}
|
||||
|
||||
mdelay(1);
|
||||
mdelay(1); /* maybe in multi core cpu */
|
||||
} while (--retry > 0);
|
||||
|
||||
if (retry <= 0)
|
||||
|
|
@ -151,7 +155,7 @@ void esp_put_sip_skb(struct sk_buff **skb)
|
|||
}
|
||||
EXPORT_SYMBOL(esp_put_sip_skb);
|
||||
|
||||
void *esp_pre_alloc_tx_aggr_buf(void)
|
||||
u8 *esp_pre_alloc_tx_aggr_buf(void)
|
||||
{
|
||||
int po;
|
||||
|
||||
|
|
@ -197,22 +201,74 @@ void esp_put_tx_aggr_buf(u8 **p)
|
|||
}
|
||||
EXPORT_SYMBOL(esp_put_tx_aggr_buf);
|
||||
|
||||
#ifdef ESP_SPI
|
||||
u8 *esp_pre_alloc_lspi_buf(void)
|
||||
{
|
||||
gl_lspi_buf = (u8 *)kmalloc(LSPI_BUF_SIZE, GFP_KERNEL);
|
||||
|
||||
if (gl_lspi_buf == NULL) {
|
||||
loge("%s no mem for gl_rlspi_buf! \n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gl_lspi_buf;
|
||||
}
|
||||
|
||||
void esp_pre_free_lspi_buf(void)
|
||||
{
|
||||
if (!gl_lspi_buf) {
|
||||
loge("%s need not free gl_lspi_buf! \n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
kfree(gl_lspi_buf);
|
||||
gl_lspi_buf = NULL;
|
||||
}
|
||||
|
||||
u8 *esp_get_lspi_buf(void)
|
||||
{
|
||||
if (!gl_lspi_buf) {
|
||||
loge(KERN_ERR "%s gl_lspi_buf is NULL failed! \n", __func__);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return gl_lspi_buf;
|
||||
}
|
||||
EXPORT_SYMBOL(esp_get_lspi_buf);
|
||||
|
||||
void esp_put_lspi_buf(u8 **p)
|
||||
{
|
||||
*p = NULL; /*input point which return by get~() , then set it null */
|
||||
}
|
||||
EXPORT_SYMBOL(esp_put_lspi_buf);
|
||||
|
||||
#endif /* ESP_SPI */
|
||||
|
||||
int esp_indi_pre_mem_init()
|
||||
{
|
||||
int err = 0;
|
||||
|
||||
|
||||
#ifdef ESP_SPI
|
||||
if (esp_pre_alloc_lspi_buf() == NULL)
|
||||
err = -ENOMEM;
|
||||
#endif
|
||||
if (esp_pre_alloc_tx_aggr_buf() == NULL)
|
||||
err = -ENOMEM;
|
||||
|
||||
if (esp_pre_alloc_sip_skb_arr() != 0)
|
||||
err = -ENOMEM;
|
||||
|
||||
if (err)
|
||||
esp_indi_pre_mem_deinit(); /* release the mem , as protect assigned atomic */
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void esp_indi_pre_mem_deinit()
|
||||
{
|
||||
#ifdef ESP_SPI
|
||||
esp_pre_free_lspi_buf();
|
||||
#endif
|
||||
esp_pre_free_tx_aggr_buf();
|
||||
esp_pre_free_sip_skb_arr();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,6 +3,10 @@
|
|||
|
||||
#include <linux/skbuff.h>
|
||||
|
||||
#ifdef ESP_SPI
|
||||
#define LSPI_BUF_SIZE (48*1024)
|
||||
#endif
|
||||
|
||||
#define TX_AGGR_BUF_SIZE (4 * PAGE_SIZE)
|
||||
#define RX_AGGR_BUF_SIZE (4 * PAGE_SIZE)
|
||||
|
||||
|
|
@ -25,13 +29,24 @@ struct esp_skb_elem {
|
|||
atomic_t inuse;
|
||||
};
|
||||
|
||||
#ifdef ESP_SPI
|
||||
u8 *esp_pre_alloc_lspi_buf(void);
|
||||
void esp_pre_free_lspi_buf(void);
|
||||
#endif
|
||||
int esp_pre_alloc_sip_skb_arr(void);
|
||||
void esp_pre_free_sip_skb_arr(void);
|
||||
u8 *esp_pre_alloc_tx_aggr_buf(void);
|
||||
void esp_pre_free_tx_aggr_buf(void);
|
||||
|
||||
struct sk_buff *esp_get_sip_skb(int size);
|
||||
void esp_put_sip_skb(struct sk_buff **skb);
|
||||
u8* esp_get_tx_aggr_buf(void);
|
||||
void esp_put_tx_aggr_buf(u8 **p);
|
||||
#ifdef ESP_SPI
|
||||
u8 *esp_get_lspi_buf(void);
|
||||
void esp_put_lspi_buf(u8 **p);
|
||||
#endif
|
||||
|
||||
void *esp_pre_alloc_tx_aggr_buf(void);
|
||||
void esp_pre_free_tx_aggr_buf(void);
|
||||
int esp_indi_pre_mem_init(void);
|
||||
void esp_indi_pre_mem_deinit(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "esp_mem.h"
|
||||
#include "esp_slab.h"
|
||||
#include "esp_log.h"
|
||||
#include "version.h"
|
||||
|
||||
#define RETRY_COUNT 10
|
||||
|
||||
|
|
@ -11,6 +12,7 @@ static int __init esp_mem_init(void)
|
|||
int retry;
|
||||
|
||||
logi("%s enter date %s %s\n", __func__, __DATE__, __TIME__);
|
||||
logi("%s VERSION [%s]\n", __func__, PREALLOC_VERSION);
|
||||
|
||||
#ifdef ESP_SLAB
|
||||
retry = RETRY_COUNT;
|
||||
|
|
@ -22,6 +24,9 @@ static int __init esp_mem_init(void)
|
|||
break;
|
||||
|
||||
} while (--retry > 0);
|
||||
|
||||
if (retry <= 0)
|
||||
goto _err_slab;
|
||||
#endif
|
||||
|
||||
#ifdef ESP_PRE_MEM
|
||||
|
|
@ -34,9 +39,21 @@ static int __init esp_mem_init(void)
|
|||
break;
|
||||
|
||||
} while (--retry > 0);
|
||||
|
||||
if (retry <= 0)
|
||||
goto _err_mem;
|
||||
#endif
|
||||
logi("%s complete \n", __func__);
|
||||
return err;
|
||||
return 0;
|
||||
|
||||
#ifdef ESP_PRE_MEM
|
||||
_err_mem:
|
||||
#endif
|
||||
#ifdef ESP_SLAB
|
||||
esp_slab_deinit();
|
||||
_err_slab:
|
||||
#endif
|
||||
return err;
|
||||
}
|
||||
|
||||
static void __exit esp_mem_exit(void)
|
||||
|
|
|
|||
|
|
@ -24,12 +24,18 @@ void *get_gl_mem_p(void)
|
|||
|
||||
static inline int esp_clz(u32 x)
|
||||
{
|
||||
return __builtin_clz(x);
|
||||
if (x == 0x0)
|
||||
return 32;
|
||||
else
|
||||
return __builtin_clz(x);
|
||||
}
|
||||
|
||||
static inline int esp_ctz(u32 x)
|
||||
{
|
||||
return __builtin_ctz(x);
|
||||
if (x == 0x0)
|
||||
return 32;
|
||||
else
|
||||
return __builtin_ctz(x);
|
||||
}
|
||||
|
||||
static inline int esp_popcount(u32 x)
|
||||
|
|
@ -40,10 +46,9 @@ static inline int esp_popcount(u32 x)
|
|||
while (x) {
|
||||
if (x&0x1)
|
||||
i++;
|
||||
x = x>>1;
|
||||
x = (x>>1);
|
||||
}
|
||||
return i;
|
||||
//return __builtin_popcount(x);
|
||||
}
|
||||
|
||||
/* bit_no value must be 0 */
|
||||
|
|
@ -52,7 +57,7 @@ static int get_next_empty_num(u32* bit_map, int bit_map_size, int bit_no)
|
|||
int i, x, offset;
|
||||
int sum;
|
||||
|
||||
i = (bit_no&0x111111e0)>>5;
|
||||
i = (bit_no&0xffffffe0)>>5;
|
||||
offset = (bit_no&0x0000001f);
|
||||
|
||||
x = esp_ctz(bit_map[i] >> offset);
|
||||
|
|
@ -86,7 +91,7 @@ static inline int get_prev_empty_num(u32* bit_map, int bit_map_size, int bit_no)
|
|||
int i, x, offset;
|
||||
int sum;
|
||||
|
||||
i = (bit_no&0x111111e0)>>5;
|
||||
i = (bit_no&0xffffffe0)>>5;
|
||||
offset = (bit_no&0x0000001f);
|
||||
|
||||
x = esp_clz(bit_map[i] << (32 - offset));
|
||||
|
|
@ -120,7 +125,7 @@ static int find_1st_empty_pos(u32* bit_map, int bit_map_size, int start_bit_no)
|
|||
int i, x, offset;
|
||||
int pos;
|
||||
|
||||
i = (start_bit_no&0x111111e0)>>5; /* integer div 32 */
|
||||
i = (start_bit_no&0xffffffe0)>>5; /* integer div 32 */
|
||||
offset = (start_bit_no&0x0000001f); /* mod 32 */
|
||||
|
||||
if (esp_popcount((u32)(bit_map[i]>>offset)) < 32 - offset) {
|
||||
|
|
@ -158,12 +163,12 @@ static void set_next_full(u32 *bit_map, int bit_map_size, int start_bit_no, int
|
|||
{
|
||||
int i, offset;
|
||||
|
||||
i = (start_bit_no&0x111111e0)>>5; /* integer div 32 */
|
||||
i = (start_bit_no&0xffffffe0)>>5; /* integer div 32 */
|
||||
offset = (start_bit_no&0x0000001f); /* mod 32 */
|
||||
|
||||
if (bit_count > 32 - offset) {
|
||||
bit_map[i] |= ~((1<<offset) - 1);
|
||||
bit_count -= (bit_count - (32 - offset));
|
||||
bit_count = bit_count - (32 - offset);
|
||||
while (bit_count > 0) {
|
||||
i++;
|
||||
if (bit_count >= 32) {
|
||||
|
|
@ -183,12 +188,12 @@ static void set_next_empty(u32 *bit_map, int bit_map_size, int start_bit_no, int
|
|||
{
|
||||
int i, offset;
|
||||
|
||||
i = (start_bit_no&0x111111e0)>>5; /* integer div 32 */
|
||||
i = (start_bit_no&0xffffffe0)>>5; /* integer div 32 */
|
||||
offset = (start_bit_no&0x0000001f); /* mod 32 */
|
||||
|
||||
if (bit_count > 32 - offset) {
|
||||
bit_map[i] &= ((1<<offset) - 1);
|
||||
bit_count -= (bit_count - (32 - offset));
|
||||
bit_count = bit_count - (32 - offset);
|
||||
while (bit_count > 0) {
|
||||
i++;
|
||||
if (bit_count >= 32) {
|
||||
|
|
@ -211,7 +216,7 @@ static inline int bin_roundup(int n, unsigned int div) /*div must be 2^n */
|
|||
|
||||
x = esp_ctz(div);
|
||||
|
||||
if (__builtin_popcount(div) > 1)
|
||||
if (esp_popcount(div) > 1)
|
||||
return -EINVAL;
|
||||
|
||||
return (n & ((1<<x)-1) ? ((n>>x) + 1)<<x : n);
|
||||
|
|
@ -234,7 +239,7 @@ static int set_access(struct esp_mem_mgmt_per *mmp, void *point, int bit_count)
|
|||
}
|
||||
}
|
||||
|
||||
if (i == 128)
|
||||
if (i == DEFAULT_MAX_ACCESSES_PER)
|
||||
return -ERANGE;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -274,10 +279,13 @@ static inline void *_esp_malloc(size_t size)
|
|||
empty_num = get_next_empty_num(gl_mm.large_mmp.bit_map, LARGE_BIT_MAP_SIZE, pos);
|
||||
if ((empty_num<<LARGE_PIECE_SIZE_SHIFT) >= size) {
|
||||
roundup_size = bin_roundup(size, LARGE_PIECE_SIZE);
|
||||
logd("large roundup_size [%d]\n", roundup_size);
|
||||
set_next_full(gl_mm.large_mmp.bit_map, LARGE_BIT_MAP_SIZE, pos, roundup_size>>LARGE_PIECE_SIZE_SHIFT);
|
||||
logd("large roundup_size [%d], pieces [%d]\n", roundup_size, roundup_size>>LARGE_PIECE_SIZE_SHIFT);
|
||||
p = (void *)((pos<<LARGE_PIECE_SIZE_SHIFT) + (u8 *)gl_mm.large_mmp.start_p);
|
||||
set_access(&gl_mm.large_mmp, p, roundup_size>>LARGE_PIECE_SIZE_SHIFT);
|
||||
if (set_access(&gl_mm.large_mmp, p, roundup_size>>LARGE_PIECE_SIZE_SHIFT) != 0) {
|
||||
spin_unlock_irqrestore(&gl_mm.large_mmp.spin_lock, gl_mm.large_mmp.lock_flags);
|
||||
return NULL;
|
||||
}
|
||||
set_next_full(gl_mm.large_mmp.bit_map, LARGE_BIT_MAP_SIZE, pos, roundup_size>>LARGE_PIECE_SIZE_SHIFT);
|
||||
spin_unlock_irqrestore(&gl_mm.large_mmp.spin_lock, gl_mm.large_mmp.lock_flags);
|
||||
return p;
|
||||
} else {
|
||||
|
|
@ -299,10 +307,13 @@ static inline void *_esp_malloc(size_t size)
|
|||
empty_num = get_next_empty_num(gl_mm.little_mmp.bit_map, LITTLE_BIT_MAP_SIZE, pos);
|
||||
if ((empty_num<<LITTLE_PIECE_SIZE_SHIFT) >= size) {
|
||||
roundup_size = bin_roundup(size, LITTLE_PIECE_SIZE);
|
||||
logd("little roundup_size [%d]\n", roundup_size);
|
||||
set_next_full(gl_mm.little_mmp.bit_map, LITTLE_BIT_MAP_SIZE, pos, roundup_size>>LITTLE_PIECE_SIZE_SHIFT);
|
||||
logd("little roundup_size [%d], pieces [%d]\n", roundup_size, roundup_size>>LITTLE_PIECE_SIZE_SHIFT);
|
||||
p = (void *)((pos<<LITTLE_PIECE_SIZE_SHIFT) + (u8 *)gl_mm.little_mmp.start_p);
|
||||
set_access(&gl_mm.little_mmp, p, roundup_size>>LITTLE_PIECE_SIZE_SHIFT);
|
||||
if (set_access(&gl_mm.little_mmp, p, roundup_size>>LITTLE_PIECE_SIZE_SHIFT) != 0) {
|
||||
spin_unlock_irqrestore(&gl_mm.little_mmp.spin_lock, gl_mm.little_mmp.lock_flags);
|
||||
return NULL;
|
||||
}
|
||||
set_next_full(gl_mm.little_mmp.bit_map, LITTLE_BIT_MAP_SIZE, pos, roundup_size>>LITTLE_PIECE_SIZE_SHIFT);
|
||||
spin_unlock_irqrestore(&gl_mm.little_mmp.spin_lock, gl_mm.little_mmp.lock_flags);
|
||||
return p;
|
||||
} else {
|
||||
|
|
@ -462,10 +473,11 @@ void esp_mm_deinit(void)
|
|||
int esp_slab_init(void)
|
||||
{
|
||||
int err = 0;
|
||||
if (esp_pre_malloc() == NULL)
|
||||
if (esp_pre_malloc() == NULL) {
|
||||
err = -ENOMEM;
|
||||
return err;
|
||||
}
|
||||
|
||||
/*TODO:other mem mgr list , but i have no time to do this*/
|
||||
err = esp_mm_init();
|
||||
|
||||
return err;
|
||||
|
|
@ -474,7 +486,6 @@ int esp_slab_init(void)
|
|||
void esp_slab_deinit(void)
|
||||
{
|
||||
esp_pre_free();
|
||||
/*TODO:other mem mgr list , but i have no time to do this*/
|
||||
esp_mm_init();
|
||||
}
|
||||
|
||||
|
|
|
|||
8
drivers/net/wireless/rockchip_wlan/esp8089/esp_premalloc/version.h
Executable file
8
drivers/net/wireless/rockchip_wlan/esp8089/esp_premalloc/version.h
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
|
||||
#ifndef __VERSION_H__
|
||||
#define __VERSION_H__
|
||||
|
||||
#define PREALLOC_VERSION "V2.3"
|
||||
|
||||
#endif /* __VERSION_H__ */
|
||||
|
||||
|
|
@ -76,49 +76,7 @@ extern int pcd_remove(struct platform_device *_dev);
|
|||
extern void hcd_remove(struct platform_device *_dev);
|
||||
extern void dwc_otg_adp_start(dwc_otg_core_if_t *core_if, uint8_t is_host);
|
||||
|
||||
#ifdef CONFIG_USB20_OTG
|
||||
static struct usb20otg_pdata_id usb20otg_pdata[] = {
|
||||
{
|
||||
.name = "rk3188-usb20otg",
|
||||
.pdata = &usb20otg_pdata_rk3188,
|
||||
},
|
||||
{
|
||||
.name = "rk3288-usb20otg",
|
||||
.pdata = &usb20otg_pdata_rk3288,
|
||||
},
|
||||
{
|
||||
.name = "rk3036-usb20otg",
|
||||
.pdata = &usb20otg_pdata_rk3036,
|
||||
},
|
||||
{
|
||||
.name = "rk3126-usb20otg",
|
||||
.pdata = &usb20otg_pdata_rk3126,
|
||||
},
|
||||
{},
|
||||
};
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB20_HOST
|
||||
static struct usb20host_pdata_id usb20host_pdata[] = {
|
||||
{
|
||||
.name = "rk3188-usb20host",
|
||||
.pdata = &usb20host_pdata_rk3188,
|
||||
},
|
||||
{
|
||||
.name = "rk3288-usb20host",
|
||||
.pdata = &usb20host_pdata_rk3288,
|
||||
},
|
||||
{
|
||||
.name = "rk3036-usb20host",
|
||||
.pdata = &usb20host_pdata_rk3036,
|
||||
},
|
||||
{
|
||||
.name = "rk3126-usb20host",
|
||||
.pdata = &usb20host_pdata_rk3126,
|
||||
},
|
||||
{},
|
||||
};
|
||||
#endif
|
||||
|
||||
static u32 usb_to_uart_status;
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
|
@ -958,19 +916,19 @@ static int host20_driver_remove(struct platform_device *_dev)
|
|||
static const struct of_device_id usb20_host_of_match[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3188_usb20_host",
|
||||
.data = &usb20host_pdata[RK3188_USB_CTLR],
|
||||
.data = &usb20host_pdata_rk3188,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3288_usb20_host",
|
||||
.data = &usb20host_pdata[RK3288_USB_CTLR],
|
||||
.data = &usb20host_pdata_rk3288,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3036_usb20_host",
|
||||
.data = &usb20host_pdata[RK3036_USB_CTLR],
|
||||
.data = &usb20host_pdata_rk3036,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3126_usb20_host",
|
||||
.data = &usb20host_pdata[RK3126_USB_CTLR],
|
||||
.data = &usb20host_pdata_rk3126,
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
|
@ -997,18 +955,16 @@ static int host20_driver_probe(struct platform_device *_dev)
|
|||
struct device *dev = &_dev->dev;
|
||||
struct device_node *node = _dev->dev.of_node;
|
||||
struct dwc_otg_platform_data *pldata;
|
||||
struct usb20host_pdata_id *p;
|
||||
const struct of_device_id *match =
|
||||
of_match_device(of_match_ptr(usb20_host_of_match), &_dev->dev);
|
||||
|
||||
if (match) {
|
||||
p = (struct usb20host_pdata_id *)match->data;
|
||||
if (match && match->data) {
|
||||
dev->platform_data = (void *)match->data;
|
||||
} else {
|
||||
dev_err(dev, "usb20host match failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev->platform_data = p->pdata;
|
||||
pldata = dev->platform_data;
|
||||
pldata->dev = dev;
|
||||
|
||||
|
|
@ -1326,22 +1282,21 @@ static int otg20_driver_remove(struct platform_device *_dev)
|
|||
static const struct of_device_id usb20_otg_of_match[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3188_usb20_otg",
|
||||
.data = &usb20otg_pdata[RK3188_USB_CTLR],
|
||||
.data = &usb20otg_pdata_rk3188,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3288_usb20_otg",
|
||||
.data = &usb20otg_pdata[RK3288_USB_CTLR],
|
||||
.data = &usb20otg_pdata_rk3288,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3036_usb20_otg",
|
||||
.data = &usb20otg_pdata[RK3036_USB_CTLR],
|
||||
.data = &usb20otg_pdata_rk3036,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3126_usb20_otg",
|
||||
.data = &usb20otg_pdata[RK3126_USB_CTLR],
|
||||
},
|
||||
{
|
||||
.data = &usb20otg_pdata_rk3126,
|
||||
},
|
||||
{ },
|
||||
};
|
||||
|
||||
MODULE_DEVICE_TABLE(of, usb20_otg_of_match);
|
||||
|
|
@ -1367,19 +1322,16 @@ static int otg20_driver_probe(struct platform_device *_dev)
|
|||
struct device *dev = &_dev->dev;
|
||||
struct device_node *node = _dev->dev.of_node;
|
||||
struct dwc_otg_platform_data *pldata;
|
||||
struct usb20otg_pdata_id *p;
|
||||
const struct of_device_id *match =
|
||||
of_match_device(of_match_ptr(usb20_otg_of_match), &_dev->dev);
|
||||
|
||||
if (match) {
|
||||
p = (struct usb20otg_pdata_id *)match->data;
|
||||
dev->platform_data = (void *)match->data;
|
||||
} else {
|
||||
dev_err(dev, "usb20otg match failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev->platform_data = p->pdata;
|
||||
/* dev->platform_data = &usb20otg_pdata; */
|
||||
pldata = dev->platform_data;
|
||||
pldata->dev = dev;
|
||||
|
||||
|
|
|
|||
|
|
@ -137,16 +137,6 @@ enum {
|
|||
RK3126_USB_CTLR,
|
||||
};
|
||||
|
||||
struct usb20otg_pdata_id {
|
||||
char name[32];
|
||||
struct dwc_otg_platform_data *pdata;
|
||||
};
|
||||
|
||||
struct usb20host_pdata_id {
|
||||
char name[32];
|
||||
struct dwc_otg_platform_data *pdata;
|
||||
};
|
||||
|
||||
struct rkehci_pdata_id {
|
||||
char name[32];
|
||||
struct rkehci_platform_data *pdata;
|
||||
|
|
|
|||
|
|
@ -212,11 +212,11 @@ static DEVICE_ATTR(hsic_debug_ehci, S_IRUGO, hsic_debug_show, NULL);
|
|||
static struct of_device_id rk_hsic_of_match[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3188_rk_hsic_host",
|
||||
.data = &rkhsic_pdata[RK3188_USB_CTLR],
|
||||
.data = &rkhsic_pdata_rk3188,
|
||||
},
|
||||
{
|
||||
.compatible = "rockchip,rk3288_rk_hsic_host",
|
||||
.data = &rkhsic_pdata[RK3288_USB_CTLR],
|
||||
.data = &rkhsic_pdata_rk3288,
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
|
@ -234,20 +234,18 @@ static int ehci_rkhsic_probe(struct platform_device *pdev)
|
|||
int retval = 0;
|
||||
static u64 usb_dmamask = 0xffffffffUL;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct rkehci_pdata_id *p;
|
||||
const struct of_device_id *match =
|
||||
of_match_device(of_match_ptr(rk_hsic_of_match), &pdev->dev);
|
||||
|
||||
dev_dbg(&pdev->dev, "ehci_rkhsic proble\n");
|
||||
|
||||
if (match) {
|
||||
p = (struct rkehci_pdata_id *)match->data;
|
||||
if (match && match->data) {
|
||||
dev->platform_data = match->data;
|
||||
} else {
|
||||
dev_err(dev, "ehci_rkhsic match failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev->platform_data = p->pdata;
|
||||
pldata = dev->platform_data;
|
||||
pldata->dev = dev;
|
||||
|
||||
|
|
|
|||
|
|
@ -41,18 +41,6 @@ struct rk_ehci_hcd {
|
|||
};
|
||||
#define EHCI_PRINT(x...) printk(KERN_INFO "EHCI: " x)
|
||||
|
||||
static struct rkehci_pdata_id rkehci_pdata[] = {
|
||||
{
|
||||
.name = "rk3188-reserved",
|
||||
.pdata = NULL,
|
||||
},
|
||||
{
|
||||
.name = "rk3288-ehci",
|
||||
.pdata = &rkehci_pdata_rk3288,
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
||||
static void rk_ehci_hcd_enable(struct work_struct *work)
|
||||
{
|
||||
struct rk_ehci_hcd *rk_ehci;
|
||||
|
|
@ -263,7 +251,7 @@ static DEVICE_ATTR(test_sq, S_IWUSR, NULL, test_sq_store);
|
|||
static struct of_device_id rk_ehci_of_match[] = {
|
||||
{
|
||||
.compatible = "rockchip,rk3288_rk_ehci_host",
|
||||
.data = &rkehci_pdata[RK3288_USB_CTLR],
|
||||
.data = &rkehci_pdata_rk3288,
|
||||
},
|
||||
{},
|
||||
};
|
||||
|
|
@ -279,21 +267,19 @@ static int ehci_rk_probe(struct platform_device *pdev)
|
|||
struct rkehci_platform_data *pldata;
|
||||
int ret;
|
||||
struct device_node *node = pdev->dev.of_node;
|
||||
struct rkehci_pdata_id *p;
|
||||
struct rk_ehci_hcd *rk_ehci;
|
||||
const struct of_device_id *match =
|
||||
of_match_device(of_match_ptr(rk_ehci_of_match), &pdev->dev);
|
||||
|
||||
dev_dbg(&pdev->dev, "ehci_rk probe!\n");
|
||||
|
||||
if (match) {
|
||||
p = (struct rkehci_pdata_id *)match->data;
|
||||
if (match && match->data) {
|
||||
dev->platform_data = (void *)match->data;
|
||||
} else {
|
||||
dev_err(dev, "ehci_rk match failed\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
dev->platform_data = p->pdata;
|
||||
pldata = dev->platform_data;
|
||||
pldata->dev = dev;
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,74 @@
|
|||
|
||||
#include "bmp_helper.h"
|
||||
|
||||
unsigned short bmp_logo_palette[] = {
|
||||
0x0000, 0x0021, 0x0840, 0x0841, 0x0041, 0x0862, 0x0043, 0x1060,
|
||||
0x1061, 0x1081, 0x18a1, 0x1082, 0x18c3, 0x18c2, 0x18e4, 0x1904,
|
||||
0x20e2, 0x2901, 0x2123, 0x2902, 0x3123, 0x3983, 0x2104, 0x2945,
|
||||
0x2924, 0x2966, 0x3144, 0x3185, 0x3984, 0x39a5, 0x31a6, 0x39c7,
|
||||
0x51a2, 0x41c4, 0x61e4, 0x4a02, 0x4a24, 0x5a65, 0x5245, 0x5226,
|
||||
0x5a66, 0x62a3, 0x7202, 0x6ac4, 0x62c7, 0x72c5, 0x7285, 0x7b03,
|
||||
0x6b05, 0x6b07, 0x7b46, 0x7326, 0x4228, 0x4a69, 0x5a88, 0x528a,
|
||||
0x5aeb, 0x62a8, 0x7b4a, 0x7ba9, 0x630c, 0x6b4d, 0x73ae, 0x7bcf,
|
||||
0x92c4, 0x8b25, 0x83a4, 0x8bc6, 0x9b65, 0x9ba6, 0xa2a2, 0xa364,
|
||||
0xa324, 0xabe5, 0xb364, 0xb3a4, 0xb386, 0x8369, 0x83a8, 0x8b8b,
|
||||
0x93a8, 0x8bcc, 0xc3c4, 0xebc1, 0x9c23, 0x9c04, 0x9406, 0x9427,
|
||||
0xac23, 0xb483, 0xa445, 0xa407, 0xacc7, 0xbc64, 0xb4c4, 0xbd26,
|
||||
0x9c2d, 0xac4c, 0xbd29, 0xc4c2, 0xc4e4, 0xc4a4, 0xdce5, 0xcc44,
|
||||
0xc563, 0xdd02, 0xdd03, 0xdd83, 0xc544, 0xcd87, 0xd544, 0xdd24,
|
||||
0xdd84, 0xddc4, 0xd5c7, 0xe462, 0xe463, 0xe4c1, 0xeca3, 0xecc2,
|
||||
0xecc2, 0xf442, 0xf4a3, 0xe444, 0xec65, 0xe485, 0xeca5, 0xecc4,
|
||||
0xecc5, 0xe4a4, 0xf465, 0xf4a4, 0xed22, 0xed23, 0xed62, 0xed63,
|
||||
0xe522, 0xedc2, 0xfd20, 0xfd02, 0xfde1, 0xfdc1, 0xf5c3, 0xf5c3,
|
||||
0xe5c1, 0xed04, 0xed25, 0xed64, 0xed65, 0xe505, 0xed66, 0xed26,
|
||||
0xed84, 0xeda5, 0xede4, 0xedc5, 0xe5e4, 0xf525, 0xf5e4, 0xf5e5,
|
||||
0xf5a4, 0xed49, 0xeda8, 0xedab, 0xf5eb, 0xf5cb, 0xedac, 0xf5cc,
|
||||
0xf5ce, 0xee21, 0xee42, 0xee22, 0xfe21, 0xf602, 0xfe63, 0xfe22,
|
||||
0xfea0, 0xfea3, 0xfee2, 0xfec3, 0xf682, 0xee65, 0xe624, 0xee85,
|
||||
0xf625, 0xf664, 0xf645, 0xfe64, 0xf624, 0xf606, 0xf684, 0xf685,
|
||||
0xfea4, 0xfee4, 0xf6c4, 0xf6a6, 0xff03, 0xff02, 0xee2f, 0xf60d,
|
||||
0xf62e, 0xf64f, 0xf64e, 0x8410, 0x8c51, 0x94b2, 0x9cd3, 0xa4b0,
|
||||
0xbd30, 0xbd72, 0xa534, 0xad55, 0xb596, 0xbdd7, 0xde75, 0xf671,
|
||||
0xf691, 0xf692, 0xf6b3, 0xf6d3, 0xfeb3, 0xf673, 0xe6b6, 0xf6d4,
|
||||
0xf6f5, 0xfef5, 0xf6f6, 0xfef6, 0xff15, 0xf716, 0xff16, 0xff17,
|
||||
0xc618, 0xce79, 0xd69a, 0xdefb, 0xef19, 0xff38, 0xff58, 0xff79,
|
||||
0xf718, 0xff7a, 0xf75a, 0xff99, 0xff9a, 0xffbb, 0xffdb, 0xe73c,
|
||||
0xef5d, 0xfffc, 0xf7be, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000,
|
||||
};
|
||||
|
||||
static void draw_unencoded_bitmap(uint16_t **dst, uint8_t *bmap, uint16_t *cmap,
|
||||
uint32_t cnt)
|
||||
{
|
||||
while (cnt > 0) {
|
||||
*(*dst)++ = cmap[*bmap++];
|
||||
cnt--;
|
||||
}
|
||||
}
|
||||
|
||||
static void draw_encoded_bitmap(uint16_t **dst, uint16_t c, uint32_t cnt)
|
||||
{
|
||||
uint16_t *fb = *dst;
|
||||
int cnt_8copy = cnt >> 3;
|
||||
|
||||
cnt -= cnt_8copy << 3;
|
||||
while (cnt_8copy > 0) {
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
*fb++ = c;
|
||||
cnt_8copy--;
|
||||
}
|
||||
while (cnt > 0) {
|
||||
*fb++ = c;
|
||||
cnt--;
|
||||
}
|
||||
*dst = fb;
|
||||
}
|
||||
|
||||
static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)
|
||||
{
|
||||
int rdif, invgdif, bdif;
|
||||
|
|
@ -38,8 +106,8 @@ static void yuv_to_rgb(int y, int u, int v, int *r, int *g, int *b)
|
|||
*b = range(y + bdif, 0, 0xff);
|
||||
}
|
||||
|
||||
int datatobmp(void *__iomem *vaddr, int width, int height, u8 data_format,
|
||||
void *data, void (*fn)(void *, void *, int))
|
||||
int bmpencoder(void *__iomem *vaddr, int width, int height, u8 data_format,
|
||||
void *data, void (*fn)(void *, void *, int))
|
||||
{
|
||||
uint32_t *d, *d1, *d2;
|
||||
uint8_t *dst, *yrgb, *uv, *y1, *y2;
|
||||
|
|
@ -169,3 +237,175 @@ int datatobmp(void *__iomem *vaddr, int width, int height, u8 data_format,
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void decode_rle8_bitmap(uint8_t *psrc, uint8_t *pdst, uint16_t *cmap,
|
||||
unsigned int width, unsigned int height,
|
||||
int bits, int x_off, int y_off, bool flip)
|
||||
{
|
||||
uint32_t cnt, runlen;
|
||||
int x = 0, y = 0;
|
||||
int decode = 1;
|
||||
uint8_t *bmap = psrc;
|
||||
uint8_t *dst = pdst;
|
||||
int linesize = width * 2;
|
||||
|
||||
if (flip) {
|
||||
y = height - 1;
|
||||
dst = pdst + y * linesize;
|
||||
}
|
||||
|
||||
while (decode) {
|
||||
if (bmap[0] == BMP_RLE8_ESCAPE) {
|
||||
switch (bmap[1]) {
|
||||
case BMP_RLE8_EOL:
|
||||
/* end of line */
|
||||
bmap += 2;
|
||||
x = 0;
|
||||
if (flip) {
|
||||
y--;
|
||||
dst -= linesize * 2;
|
||||
} else {
|
||||
y++;
|
||||
}
|
||||
break;
|
||||
case BMP_RLE8_EOBMP:
|
||||
/* end of bitmap */
|
||||
decode = 0;
|
||||
break;
|
||||
case BMP_RLE8_DELTA:
|
||||
/* delta run */
|
||||
x += bmap[2];
|
||||
if (flip) {
|
||||
y -= bmap[3];
|
||||
dst -= bmap[3] * linesize;
|
||||
dst += bmap[2] * 2;
|
||||
} else {
|
||||
y += bmap[3];
|
||||
dst += bmap[3] * linesize;
|
||||
dst += bmap[2] * 2;
|
||||
}
|
||||
bmap += 4;
|
||||
break;
|
||||
default:
|
||||
/* unencoded run */
|
||||
runlen = bmap[1];
|
||||
bmap += 2;
|
||||
if (y >= height || x >= width) {
|
||||
decode = 0;
|
||||
break;
|
||||
}
|
||||
if (x + runlen > width)
|
||||
cnt = width - x;
|
||||
else
|
||||
cnt = runlen;
|
||||
draw_unencoded_bitmap((uint16_t **)&dst, bmap,
|
||||
cmap, cnt);
|
||||
x += runlen;
|
||||
bmap += runlen;
|
||||
if (runlen & 1)
|
||||
bmap++;
|
||||
}
|
||||
} else {
|
||||
/* encoded run */
|
||||
if (y < height) {
|
||||
runlen = bmap[0];
|
||||
if (x < width) {
|
||||
/* aggregate the same code */
|
||||
while (bmap[0] == 0xff &&
|
||||
bmap[2] != BMP_RLE8_ESCAPE &&
|
||||
bmap[1] == bmap[3]) {
|
||||
runlen += bmap[2];
|
||||
bmap += 2;
|
||||
}
|
||||
if (x + runlen > width)
|
||||
cnt = width - x;
|
||||
else
|
||||
cnt = runlen;
|
||||
draw_encoded_bitmap((uint16_t **)&dst,
|
||||
cmap[bmap[1]], cnt);
|
||||
}
|
||||
x += runlen;
|
||||
}
|
||||
bmap += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bmpdecoder(void *bmp_addr, void *pdst, int *width, int *height, int *bits)
|
||||
{
|
||||
BITMAPHEADER header;
|
||||
BITMAPINFOHEADER infoheader;
|
||||
uint32_t size;
|
||||
uint16_t linesize;
|
||||
char *src = bmp_addr;
|
||||
char *dst = pdst;
|
||||
int i, j;
|
||||
bool flip = false;
|
||||
|
||||
memcpy(&header, src, sizeof(header));
|
||||
src += sizeof(header);
|
||||
memcpy(&infoheader, src, sizeof(infoheader));
|
||||
*width = infoheader.width;
|
||||
*height = infoheader.height;
|
||||
|
||||
if (*height < 0)
|
||||
*height = 0 - *height;
|
||||
else
|
||||
flip = true;
|
||||
|
||||
size = header.size - header.offset;
|
||||
linesize = *width * infoheader.bitcount >> 3;
|
||||
src = bmp_addr + header.offset;
|
||||
|
||||
switch (infoheader.bitcount) {
|
||||
case 8:
|
||||
/*
|
||||
* only support convert 8bit bmap file to RGB565.
|
||||
*/
|
||||
decode_rle8_bitmap(src, dst, bmp_logo_palette,
|
||||
infoheader.width, infoheader.height,
|
||||
infoheader.bitcount, 0, 0, flip);
|
||||
*bits = 16;
|
||||
break;
|
||||
case 16:
|
||||
/*
|
||||
* Todo
|
||||
*/
|
||||
pr_info("unsupport bit=%d now\n", infoheader.bitcount);
|
||||
break;
|
||||
case 24:
|
||||
if (size % 3 != 0) {
|
||||
pr_info("wrong bmp file with unalign size\n");
|
||||
|
||||
return -EINVAL;
|
||||
}
|
||||
if (flip)
|
||||
src += (*width) * (*height - 1) * 3;
|
||||
|
||||
for (i = 0; i < *height; i++) {
|
||||
for (j = 0; j < *width; j++) {
|
||||
dst[0] = src[2];
|
||||
dst[1] = src[1];
|
||||
dst[2] = src[0];
|
||||
dst += 3;
|
||||
src += 3;
|
||||
}
|
||||
if (flip)
|
||||
src -= *width * 3 * 2;
|
||||
}
|
||||
|
||||
*bits = 24;
|
||||
break;
|
||||
case 32:
|
||||
/*
|
||||
* Todo
|
||||
*/
|
||||
pr_info("unsupport bit=%d now\n", infoheader.bitcount);
|
||||
break;
|
||||
default:
|
||||
pr_info("unsupport bit=%d now\n", infoheader.bitcount);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,8 +41,14 @@ typedef struct bmpinfoheader {
|
|||
unsigned int colorsimportant;
|
||||
}__attribute__((packed)) BITMAPINFOHEADER;
|
||||
|
||||
#define BMP_RLE8_ESCAPE 0
|
||||
#define BMP_RLE8_EOL 0
|
||||
#define BMP_RLE8_EOBMP 1
|
||||
#define BMP_RLE8_DELTA 2
|
||||
|
||||
#define range(x, min, max) ((x) < (min)) ? (min) : (((x) > (max)) ? (max) : (x))
|
||||
|
||||
int datatobmp(void *__iomem *vaddr,int width, int height, u8 data_format,
|
||||
void *data, void (*fn)(void *, void *, int));
|
||||
int bmpencoder(void *__iomem *vaddr,int width, int height, u8 data_format,
|
||||
void *data, void (*fn)(void *, void *, int));
|
||||
int bmpdecoder(void *bmp_addr, void *dst, int *width, int *height, int *bits);
|
||||
#endif /* _BMP_HELPER_H_ */
|
||||
|
|
|
|||
|
|
@ -180,8 +180,8 @@ static int rk3036_lcdc_alpha_cfg(struct lcdc_device *lcdc_dev)
|
|||
{
|
||||
int win0_top = 0;
|
||||
u32 mask, val;
|
||||
enum data_format win0_format = lcdc_dev->driver.win[0]->format;
|
||||
enum data_format win1_format = lcdc_dev->driver.win[1]->format;
|
||||
enum data_format win0_format = lcdc_dev->driver.win[0]->area[0].format;
|
||||
enum data_format win1_format = lcdc_dev->driver.win[1]->area[0].format;
|
||||
|
||||
int win0_alpha_en = ((win0_format == ARGB888) ||
|
||||
(win0_format == ABGR888)) ? 1 : 0;
|
||||
|
|
@ -252,8 +252,8 @@ static void lcdc_layer_update_regs(struct lcdc_device *lcdc_dev,
|
|||
if (win->id == 0) {
|
||||
mask = m_WIN0_EN | m_WIN0_FORMAT | m_WIN0_RB_SWAP;
|
||||
val = v_WIN0_EN(win->state) |
|
||||
v_WIN0_FORMAT(win->fmt_cfg) |
|
||||
v_WIN0_RB_SWAP(win->swap_rb);
|
||||
v_WIN0_FORMAT(win->area[0].fmt_cfg) |
|
||||
v_WIN0_RB_SWAP(win->area[0].swap_rb);
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, mask, val);
|
||||
lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_YRGB,
|
||||
v_X_SCL_FACTOR(win->scale_yrgb_x) |
|
||||
|
|
@ -282,8 +282,8 @@ static void lcdc_layer_update_regs(struct lcdc_device *lcdc_dev,
|
|||
} else if (win->id == 1) {
|
||||
mask = m_WIN1_EN | m_WIN1_FORMAT | m_WIN1_RB_SWAP;
|
||||
val = v_WIN1_EN(win->state) |
|
||||
v_WIN1_FORMAT(win->fmt_cfg) |
|
||||
v_WIN1_RB_SWAP(win->swap_rb);
|
||||
v_WIN1_FORMAT(win->area[0].fmt_cfg) |
|
||||
v_WIN1_RB_SWAP(win->area[0].swap_rb);
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, mask, val);
|
||||
lcdc_writel(lcdc_dev, WIN1_SCL_FACTOR_YRGB,
|
||||
v_X_SCL_FACTOR(win->scale_yrgb_x) |
|
||||
|
|
@ -823,35 +823,35 @@ static int rk3036_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
win->scale_yrgb_x = calscale(win->area[0].xact, win->post_cfg.xsize);
|
||||
win->scale_yrgb_y = calscale(win->area[0].yact, win->post_cfg.ysize);
|
||||
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case ARGB888:
|
||||
win->fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case XBGR888:
|
||||
win->fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->swap_rb = 1;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->area[0].swap_rb = 1;
|
||||
break;
|
||||
case ABGR888:
|
||||
win->fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->swap_rb = 1;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->area[0].swap_rb = 1;
|
||||
break;
|
||||
case RGB888:
|
||||
win->fmt_cfg = VOP_FORMAT_RGB888;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_RGB888;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
win->fmt_cfg = VOP_FORMAT_RGB565;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_RGB565;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case YUV444:
|
||||
if (win_id == 0) {
|
||||
win->fmt_cfg = VOP_FORMAT_YCBCR444;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_YCBCR444;
|
||||
win->scale_cbcr_x = calscale(win->area[0].xact,
|
||||
win->post_cfg.xsize);
|
||||
win->scale_cbcr_y = calscale(win->area[0].yact,
|
||||
win->post_cfg.ysize);
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
} else {
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n",
|
||||
|
|
@ -860,12 +860,12 @@ static int rk3036_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
break;
|
||||
case YUV422:
|
||||
if (win_id == 0) {
|
||||
win->fmt_cfg = VOP_FORMAT_YCBCR422;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_YCBCR422;
|
||||
win->scale_cbcr_x = calscale((win->area[0].xact / 2),
|
||||
win->post_cfg.xsize);
|
||||
win->scale_cbcr_y = calscale(win->area[0].yact,
|
||||
win->post_cfg.ysize);
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
} else {
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n",
|
||||
|
|
@ -874,12 +874,12 @@ static int rk3036_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
break;
|
||||
case YUV420:
|
||||
if (win_id == 0) {
|
||||
win->fmt_cfg = VOP_FORMAT_YCBCR420;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_YCBCR420;
|
||||
win->scale_cbcr_x = calscale(win->area[0].xact / 2,
|
||||
win->post_cfg.xsize);
|
||||
win->scale_cbcr_y = calscale(win->area[0].yact / 2,
|
||||
win->post_cfg.ysize);
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
} else {
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n",
|
||||
|
|
@ -896,7 +896,7 @@ static int rk3036_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
DBG(2, "lcdc%d>>%s\n"
|
||||
">>format:%s>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d\n"
|
||||
">>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", lcdc_dev->id,
|
||||
__func__, get_format_string(win->format, fmt),
|
||||
__func__, get_format_string(win->area[0].format, fmt),
|
||||
win->area[0].xact, win->area[0].yact, win->post_cfg.xsize,
|
||||
win->post_cfg.ysize, win->area[0].xvir, win->area[0].yvir,
|
||||
win->post_cfg.xpos, win->post_cfg.ypos);
|
||||
|
|
@ -1487,7 +1487,7 @@ static ssize_t rk3036_lcdc_get_disp_info(struct rk_lcdc_driver *dev_drv,
|
|||
}
|
||||
|
||||
size = snprintf(buf, PAGE_SIZE, "win%d: %s\n", win_id,
|
||||
get_format_string(win->format, fmt));
|
||||
get_format_string(win->area[0].format, fmt));
|
||||
size += snprintf(buf + size, PAGE_SIZE - size,
|
||||
" xact %d yact %d xvir %d yvir %d\n",
|
||||
win->area[0].xact, win->area[0].yact,
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ static void rk_lcdc_read_reg_defalut_cfg(struct lcdc_device *lcdc_dev)
|
|||
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
for (reg = 0; reg < 0xe0; reg += 4) {
|
||||
val = lcdc_readl(lcdc_dev, reg);
|
||||
val = lcdc_readl_backup(lcdc_dev, reg);
|
||||
if (reg == WIN0_ACT_INFO) {
|
||||
win0->area[0].xact = (val & m_ACT_WIDTH)+1;
|
||||
win0->area[0].yact = ((val & m_ACT_HEIGHT)>>16)+1;
|
||||
|
|
@ -285,8 +285,8 @@ static int rk312x_lcdc_alpha_cfg(struct lcdc_device *lcdc_dev)
|
|||
{
|
||||
int win0_top = 0;
|
||||
u32 mask, val;
|
||||
enum data_format win0_format = lcdc_dev->driver.win[0]->format;
|
||||
enum data_format win1_format = lcdc_dev->driver.win[1]->format;
|
||||
enum data_format win0_format = lcdc_dev->driver.win[0]->area[0].format;
|
||||
enum data_format win1_format = lcdc_dev->driver.win[1]->area[0].format;
|
||||
|
||||
int win0_alpha_en = ((win0_format == ARGB888) ||
|
||||
(win0_format == ABGR888)) ? 1 : 0;
|
||||
|
|
@ -367,7 +367,7 @@ static void lcdc_layer_csc_mode(struct lcdc_device *lcdc_dev,
|
|||
struct rk_screen *screen = dev_drv->cur_screen;
|
||||
|
||||
if (dev_drv->overlay_mode == VOP_YUV_DOMAIN) {
|
||||
switch (win->fmt_cfg) {
|
||||
switch (win->area[0].fmt_cfg) {
|
||||
case VOP_FORMAT_ARGB888:
|
||||
case VOP_FORMAT_RGB888:
|
||||
case VOP_FORMAT_RGB565:
|
||||
|
|
@ -389,7 +389,7 @@ static void lcdc_layer_csc_mode(struct lcdc_device *lcdc_dev,
|
|||
v_WIN1_CSC_MODE(win->csc_mode));
|
||||
}
|
||||
} else if (dev_drv->overlay_mode == VOP_RGB_DOMAIN) {
|
||||
switch (win->fmt_cfg) {
|
||||
switch (win->area[0].fmt_cfg) {
|
||||
case VOP_FORMAT_YCBCR420:
|
||||
if (win->id == 0) {
|
||||
win->csc_mode = VOP_Y2R_CSC_MPEG;
|
||||
|
|
@ -418,8 +418,8 @@ static void lcdc_layer_update_regs(struct lcdc_device *lcdc_dev,
|
|||
if (win->id == 0) {
|
||||
mask = m_WIN0_EN | m_WIN0_FORMAT | m_WIN0_RB_SWAP;
|
||||
val = v_WIN0_EN(win->state) |
|
||||
v_WIN0_FORMAT(win->fmt_cfg) |
|
||||
v_WIN0_RB_SWAP(win->swap_rb);
|
||||
v_WIN0_FORMAT(win->area[0].fmt_cfg) |
|
||||
v_WIN0_RB_SWAP(win->area[0].swap_rb);
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, mask, val);
|
||||
lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_YRGB,
|
||||
v_X_SCL_FACTOR(win->scale_yrgb_x) |
|
||||
|
|
@ -449,8 +449,8 @@ static void lcdc_layer_update_regs(struct lcdc_device *lcdc_dev,
|
|||
} else if (win->id == 1) {
|
||||
mask = m_WIN1_EN | m_WIN1_FORMAT | m_WIN1_RB_SWAP;
|
||||
val = v_WIN1_EN(win->state) |
|
||||
v_WIN1_FORMAT(win->fmt_cfg) |
|
||||
v_WIN1_RB_SWAP(win->swap_rb);
|
||||
v_WIN1_FORMAT(win->area[0].fmt_cfg) |
|
||||
v_WIN1_RB_SWAP(win->area[0].swap_rb);
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, mask, val);
|
||||
/* rk312x unsupport win1 scale */
|
||||
if (lcdc_dev->soc_type == VOP_RK3036) {
|
||||
|
|
@ -1057,7 +1057,8 @@ static void rk312x_lcdc_select_bcsh(struct rk_lcdc_driver *dev_drv,
|
|||
if (dev_drv->output_color == COLOR_RGB) {
|
||||
/* bypass */
|
||||
bcsh_ctrl = lcdc_readl(lcdc_dev, BCSH_CTRL);
|
||||
if ((bcsh_ctrl&m_BCSH_EN) == 1)/*bcsh enabled*/
|
||||
if (((bcsh_ctrl&m_BCSH_EN) == 1) ||
|
||||
(dev_drv->bcsh.enable == 1))/*bcsh enabled*/
|
||||
lcdc_msk_reg(lcdc_dev, BCSH_CTRL,
|
||||
m_BCSH_R2Y_EN | m_BCSH_Y2R_EN,
|
||||
v_BCSH_R2Y_EN(1) | v_BCSH_Y2R_EN(1));
|
||||
|
|
@ -1482,35 +1483,35 @@ static int rk312x_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
win->scale_yrgb_x = CalScale(win->area[0].xact, win->area[0].xsize);
|
||||
win->scale_yrgb_y = CalScale(win->area[0].yact, win->area[0].ysize);
|
||||
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case ARGB888:
|
||||
win->fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case XBGR888:
|
||||
win->fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->swap_rb = 1;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->area[0].swap_rb = 1;
|
||||
break;
|
||||
case ABGR888:
|
||||
win->fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->swap_rb = 1;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_ARGB888;
|
||||
win->area[0].swap_rb = 1;
|
||||
break;
|
||||
case RGB888:
|
||||
win->fmt_cfg = VOP_FORMAT_RGB888;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_RGB888;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
win->fmt_cfg = VOP_FORMAT_RGB565;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_RGB565;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case YUV444:
|
||||
if (win_id == 0) {
|
||||
win->fmt_cfg = VOP_FORMAT_YCBCR444;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_YCBCR444;
|
||||
win->scale_cbcr_x =
|
||||
CalScale(win->area[0].xact, win->area[0].xsize);
|
||||
win->scale_cbcr_y =
|
||||
CalScale(win->area[0].yact, win->area[0].ysize);
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
} else {
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n", __func__);
|
||||
|
|
@ -1518,12 +1519,12 @@ static int rk312x_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
break;
|
||||
case YUV422:
|
||||
if (win_id == 0) {
|
||||
win->fmt_cfg = VOP_FORMAT_YCBCR422;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_YCBCR422;
|
||||
win->scale_cbcr_x = CalScale((win->area[0].xact / 2),
|
||||
win->area[0].xsize);
|
||||
win->scale_cbcr_y =
|
||||
CalScale(win->area[0].yact, win->area[0].ysize);
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
} else {
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n", __func__);
|
||||
|
|
@ -1531,12 +1532,12 @@ static int rk312x_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
break;
|
||||
case YUV420:
|
||||
if (win_id == 0) {
|
||||
win->fmt_cfg = VOP_FORMAT_YCBCR420;
|
||||
win->area[0].fmt_cfg = VOP_FORMAT_YCBCR420;
|
||||
win->scale_cbcr_x =
|
||||
CalScale(win->area[0].xact / 2, win->area[0].xsize);
|
||||
win->scale_cbcr_y =
|
||||
CalScale(win->area[0].yact / 2, win->area[0].ysize);
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
} else {
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n", __func__);
|
||||
|
|
@ -1552,7 +1553,7 @@ static int rk312x_lcdc_set_par(struct rk_lcdc_driver *dev_drv, int win_id)
|
|||
DBG(1,
|
||||
"lcdc%d>>%s\n>>format:%s>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d\n"
|
||||
">>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", lcdc_dev->id, __func__,
|
||||
get_format_string(win->format, fmt), win->area[0].xact,
|
||||
get_format_string(win->area[0].format, fmt), win->area[0].xact,
|
||||
win->area[0].yact, win->area[0].xsize, win->area[0].ysize,
|
||||
win->area[0].xvir, win->area[0].yvir, win->area[0].xpos,
|
||||
win->area[0].ypos);
|
||||
|
|
@ -2008,7 +2009,6 @@ static int rk312x_lcdc_open_bcsh(struct rk_lcdc_driver *dev_drv, bool open)
|
|||
}
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
if (lcdc_dev->clk_on) {
|
||||
rk312x_lcdc_select_bcsh(dev_drv, lcdc_dev);
|
||||
if (open) {
|
||||
lcdc_msk_reg(lcdc_dev,
|
||||
BCSH_CTRL, m_BCSH_EN | m_BCSH_OUT_MODE,
|
||||
|
|
@ -2018,11 +2018,14 @@ static int rk312x_lcdc_open_bcsh(struct rk_lcdc_driver *dev_drv, bool open)
|
|||
v_BCSH_CONTRAST(0x80) |
|
||||
v_BCSH_SAT_CON(0x80));
|
||||
lcdc_writel(lcdc_dev, BCSH_H, v_BCSH_COS_HUE(0x80));
|
||||
dev_drv->bcsh.enable = 1;
|
||||
} else {
|
||||
mask = m_BCSH_EN;
|
||||
val = v_BCSH_EN(0);
|
||||
lcdc_msk_reg(lcdc_dev, BCSH_CTRL, mask, val);
|
||||
dev_drv->bcsh.enable = 0;
|
||||
}
|
||||
rk312x_lcdc_select_bcsh(dev_drv, lcdc_dev);
|
||||
lcdc_cfg_done(lcdc_dev);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -703,6 +703,13 @@ static inline void lcdc_writel(struct lcdc_device *lcdc_dev, u32 offset, u32 v)
|
|||
}
|
||||
|
||||
static inline u32 lcdc_readl(struct lcdc_device *lcdc_dev, u32 offset)
|
||||
{
|
||||
u32 v;
|
||||
v = readl_relaxed(lcdc_dev->regs + offset);
|
||||
return v;
|
||||
}
|
||||
|
||||
static inline u32 lcdc_readl_backup(struct lcdc_device *lcdc_dev, u32 offset)
|
||||
{
|
||||
u32 v;
|
||||
u32 *_pv = (u32*)lcdc_dev->regsbak;
|
||||
|
|
|
|||
|
|
@ -173,10 +173,10 @@ static void rk3188_lcdc_read_reg_defalut_cfg(struct lcdc_device
|
|||
lcdc_dev->atv_layer_cnt = win0->state;
|
||||
else
|
||||
lcdc_dev->atv_layer_cnt = win1->state;
|
||||
win0->swap_rb = (value & m_WIN0_RB_SWAP) >> 15;
|
||||
win1->swap_rb = (value & m_WIN1_RB_SWAP) >> 19;
|
||||
win0->fmt_cfg = (value & m_WIN0_FORMAT) >> 3;
|
||||
win1->fmt_cfg = (value & m_WIN1_FORMAT) >> 6;
|
||||
win0->area[0].swap_rb = (value & m_WIN0_RB_SWAP) >> 15;
|
||||
win1->area[0].swap_rb = (value & m_WIN1_RB_SWAP) >> 19;
|
||||
win0->area[0].fmt_cfg = (value & m_WIN0_FORMAT) >> 3;
|
||||
win1->area[0].fmt_cfg = (value & m_WIN1_FORMAT) >> 6;
|
||||
break;
|
||||
case WIN0_SCL_FACTOR_YRGB:
|
||||
win0->scale_yrgb_x = (value >> 0) & 0xffff;
|
||||
|
|
@ -325,8 +325,8 @@ static int rk3188_lcdc_alpha_cfg(struct lcdc_device *lcdc_dev)
|
|||
{
|
||||
int win0_top = 0;
|
||||
u32 mask, val;
|
||||
enum data_format win0_format = lcdc_dev->driver.win[0]->format;
|
||||
enum data_format win1_format = lcdc_dev->driver.win[1]->format;
|
||||
enum data_format win0_format = lcdc_dev->driver.win[0]->area[0].format;
|
||||
enum data_format win1_format = lcdc_dev->driver.win[1]->area[0].format;
|
||||
|
||||
int win0_alpha_en = ((win0_format == ARGB888)
|
||||
|| (win0_format == ABGR888)) ? 1 : 0;
|
||||
|
|
@ -376,15 +376,16 @@ static int rk3188_lcdc_reg_update(struct rk_lcdc_driver *dev_drv)
|
|||
m_WIN0_EN | m_WIN1_EN | m_WIN0_RB_SWAP |
|
||||
m_WIN1_RB_SWAP,
|
||||
v_WIN0_EN(win0->state) | v_WIN1_EN(win1->state) |
|
||||
v_WIN0_RB_SWAP(win0->swap_rb) |
|
||||
v_WIN1_RB_SWAP(win1->swap_rb));
|
||||
v_WIN0_RB_SWAP(win0->area[0].swap_rb) |
|
||||
v_WIN1_RB_SWAP(win1->area[0].swap_rb));
|
||||
lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_YRGB,
|
||||
v_X_SCL_FACTOR(win0->scale_yrgb_x) |
|
||||
v_Y_SCL_FACTOR(win0->scale_yrgb_y));
|
||||
lcdc_writel(lcdc_dev, WIN0_SCL_FACTOR_CBR,
|
||||
v_X_SCL_FACTOR(win0->scale_cbcr_x) |
|
||||
v_Y_SCL_FACTOR(win0->scale_cbcr_y));
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, m_WIN0_FORMAT, v_WIN0_FORMAT(win0->fmt_cfg));
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, m_WIN0_FORMAT,
|
||||
v_WIN0_FORMAT(win0->area[0].fmt_cfg));
|
||||
lcdc_writel(lcdc_dev, WIN0_ACT_INFO, v_ACT_WIDTH(win0->area[0].xact) |
|
||||
v_ACT_HEIGHT(win0->area[0].yact));
|
||||
lcdc_writel(lcdc_dev, WIN0_DSP_ST, v_DSP_STX(win0->area[0].dsp_stx) |
|
||||
|
|
@ -399,9 +400,10 @@ static int rk3188_lcdc_reg_update(struct rk_lcdc_driver *dev_drv)
|
|||
v_DSP_HEIGHT(win1->area[0].ysize));
|
||||
lcdc_writel(lcdc_dev, WIN1_DSP_ST, v_DSP_STX(win1->area[0].dsp_stx) |
|
||||
v_DSP_STY(win1->area[0].dsp_sty));
|
||||
lcdc_msk_reg(lcdc_dev, WIN_VIR, m_WIN1_VIR, ((win1->area[0].y_vir_stride)&0x1fff)<<16);
|
||||
lcdc_msk_reg(lcdc_dev, WIN_VIR, m_WIN1_VIR,
|
||||
((win1->area[0].y_vir_stride)&0x1fff)<<16);
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, m_WIN1_FORMAT,
|
||||
v_WIN1_FORMAT(win1->fmt_cfg));
|
||||
v_WIN1_FORMAT(win1->area[0].fmt_cfg));
|
||||
lcdc_writel(lcdc_dev, WIN1_MST, win1->area[0].y_addr);
|
||||
rk3188_lcdc_alpha_cfg(lcdc_dev);
|
||||
lcdc_cfg_done(lcdc_dev);
|
||||
|
|
@ -758,7 +760,7 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
|
||||
ScaleYrgbX = CalScale(xact, win->area[0].xsize);
|
||||
ScaleYrgbY = CalScale(yact, win->area[0].ysize);
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case ARGB888:
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
|
|
@ -793,7 +795,7 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
|
||||
DBG(1, "lcdc%d>>%s\n>>format:%s>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d\n"
|
||||
">>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", lcdc_dev->id,
|
||||
__func__, get_format_string(win->format, fmt), xact,
|
||||
__func__, get_format_string(win->area[0].format, fmt), xact,
|
||||
yact, win->area[0].xsize, win->area[0].ysize, xvir, yvir, xpos, ypos);
|
||||
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
|
|
@ -802,28 +804,28 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
win->scale_yrgb_y = ScaleYrgbY;
|
||||
win->scale_cbcr_x = ScaleCbrX;
|
||||
win->scale_cbcr_y = ScaleCbrY;
|
||||
win->fmt_cfg = fmt_cfg;
|
||||
win->area[0].fmt_cfg = fmt_cfg;
|
||||
win->area[0].dsp_stx = xpos;
|
||||
win->area[0].dsp_sty = ypos;
|
||||
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
win->swap_rb = 1;
|
||||
win->area[0].swap_rb = 1;
|
||||
break;
|
||||
case ARGB888:
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case RGB888:
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case YUV422:
|
||||
case YUV420:
|
||||
case YUV444:
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
default:
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
|
|
@ -842,7 +844,8 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
v_DSP_HEIGHT(win->area[0].ysize));
|
||||
lcdc_msk_reg(lcdc_dev, WIN_VIR, m_WIN0_VIR, v_WIN0_VIR_VAL(win->area[0].y_vir_stride));
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, m_WIN0_EN | m_WIN0_RB_SWAP,
|
||||
v_WIN0_EN(win->state) | v_WIN0_RB_SWAP(win->swap_rb));
|
||||
v_WIN0_EN(win->state) |
|
||||
v_WIN0_RB_SWAP(win->area[0].swap_rb));
|
||||
lcdc_msk_reg(lcdc_dev, WIN0_COLOR_KEY, m_COLOR_KEY_EN, v_COLOR_KEY_EN(0));
|
||||
}
|
||||
spin_unlock(&lcdc_dev->reg_lock);
|
||||
|
|
@ -866,45 +869,48 @@ static int win1_set_par(struct lcdc_device *lcdc_dev,
|
|||
|
||||
DBG(1, "lcdc%d>>%s>>format:%s>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d\n"
|
||||
">>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", lcdc_dev->id,
|
||||
__func__, get_format_string(win->format, fmt), xact, yact,
|
||||
win->area[0].xsize, win->area[0].ysize, xvir, yvir, xpos, ypos);
|
||||
__func__, get_format_string(win->area[0].format, fmt),
|
||||
xact, yact, win->area[0].xsize, win->area[0].ysize,
|
||||
xvir, yvir, xpos, ypos);
|
||||
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
win->area[0].dsp_stx = xpos;
|
||||
win->area[0].dsp_sty = ypos;
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 1;
|
||||
win->area[0].swap_rb = 1;
|
||||
break;
|
||||
case ARGB888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
|
||||
break;
|
||||
case RGB888:
|
||||
fmt_cfg = 1;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
fmt_cfg = 2;
|
||||
win->swap_rb = 0;
|
||||
win->area[0].swap_rb = 0;
|
||||
break;
|
||||
default:
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
"%s:un supported format!\n", __func__);
|
||||
break;
|
||||
}
|
||||
win->fmt_cfg = fmt_cfg;
|
||||
win->area[0].fmt_cfg = fmt_cfg;
|
||||
if (likely(lcdc_dev->clk_on)) {
|
||||
lcdc_writel(lcdc_dev, WIN1_DSP_INFO,v_DSP_WIDTH(win->area[0].xsize) |
|
||||
v_DSP_HEIGHT(win->area[0].ysize));
|
||||
lcdc_writel(lcdc_dev, WIN1_DSP_ST,v_DSP_STX(xpos) | v_DSP_STY(ypos));
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL, m_WIN1_EN | m_WIN1_RB_SWAP,
|
||||
v_WIN1_EN(win->state) | v_WIN1_RB_SWAP(win->swap_rb));
|
||||
v_WIN1_EN(win->state) |
|
||||
v_WIN1_RB_SWAP(win->area[0].swap_rb));
|
||||
lcdc_msk_reg(lcdc_dev, SYS_CTRL,m_WIN1_FORMAT, v_WIN1_FORMAT(fmt_cfg));
|
||||
lcdc_msk_reg(lcdc_dev, WIN_VIR, m_WIN1_VIR, ((win->area[0].y_vir_stride)&0x1fff)<<16);
|
||||
lcdc_msk_reg(lcdc_dev, WIN_VIR, m_WIN1_VIR,
|
||||
((win->area[0].y_vir_stride)&0x1fff)<<16);
|
||||
}
|
||||
spin_unlock(&lcdc_dev->reg_lock);
|
||||
|
||||
|
|
|
|||
|
|
@ -312,22 +312,23 @@ static void lcdc_read_reg_defalut_cfg(struct lcdc_device *lcdc_dev)
|
|||
break;
|
||||
case WIN0_CTRL0:
|
||||
win0->state = val & m_WIN0_EN;
|
||||
win0->fmt_cfg = (val & m_WIN0_DATA_FMT) >> 1;
|
||||
win0->area[0].fmt_cfg =
|
||||
(val & m_WIN0_DATA_FMT) >> 1;
|
||||
win0->fmt_10 = (val & m_WIN0_FMT_10) >> 4;
|
||||
win0->format = win0->fmt_cfg;
|
||||
win0->area[0].format = win0->area[0].fmt_cfg;
|
||||
break;
|
||||
case WIN0_VIR:
|
||||
win0->area[0].y_vir_stride =
|
||||
val & m_WIN0_VIR_STRIDE;
|
||||
win0->area[0].uv_vir_stride =
|
||||
(val & m_WIN0_VIR_STRIDE_UV) >> 16;
|
||||
if (win0->format == ARGB888)
|
||||
if (win0->area[0].format == ARGB888)
|
||||
win0->area[0].xvir =
|
||||
win0->area[0].y_vir_stride;
|
||||
else if (win0->format == RGB888)
|
||||
else if (win0->area[0].format == RGB888)
|
||||
win0->area[0].xvir =
|
||||
win0->area[0].y_vir_stride * 4 / 3;
|
||||
else if (win0->format == RGB565)
|
||||
else if (win0->area[0].format == RGB565)
|
||||
win0->area[0].xvir =
|
||||
2 * win0->area[0].y_vir_stride;
|
||||
else /* YUV */
|
||||
|
|
@ -376,6 +377,7 @@ static int rk3288_lcdc_pre_init(struct rk_lcdc_driver *dev_drv)
|
|||
|
||||
/*backup reg config at uboot*/
|
||||
lcdc_read_reg_defalut_cfg(lcdc_dev);
|
||||
v = 0;
|
||||
#ifndef CONFIG_RK_FPGA
|
||||
if (lcdc_dev->pwr18 == true) {
|
||||
v = 0x00010001; /*bit14: 1,1.8v;0,3.3v*/
|
||||
|
|
@ -580,7 +582,8 @@ static int rk3288_lcdc_alpha_cfg(struct rk_lcdc_driver *dev_drv,int win_id)
|
|||
u32 mask, val;
|
||||
int ppixel_alpha,global_alpha;
|
||||
u32 src_alpha_ctl,dst_alpha_ctl;
|
||||
ppixel_alpha = ((win->format == ARGB888)||(win->format == ABGR888)) ? 1 : 0;
|
||||
ppixel_alpha = ((win->area[0].format == ARGB888) ||
|
||||
(win->area[0].format == ABGR888)) ? 1 : 0;
|
||||
global_alpha = (win->g_alpha_val == 0) ? 0 : 1;
|
||||
alpha_config.src_global_alpha_val = win->g_alpha_val;
|
||||
win->alpha_mode = AB_SRC_OVER;
|
||||
|
|
@ -765,10 +768,11 @@ static int rk3288_win_0_1_reg_update(struct rk_lcdc_driver *dev_drv,int win_id)
|
|||
if(win->state == 1){
|
||||
mask = m_WIN0_EN | m_WIN0_DATA_FMT | m_WIN0_FMT_10 |
|
||||
m_WIN0_LB_MODE | m_WIN0_RB_SWAP;
|
||||
val = v_WIN0_EN(win->state) | v_WIN0_DATA_FMT(win->fmt_cfg) |
|
||||
val = v_WIN0_EN(win->state) |
|
||||
v_WIN0_DATA_FMT(win->area[0].fmt_cfg) |
|
||||
v_WIN0_FMT_10(win->fmt_10) |
|
||||
v_WIN0_LB_MODE(win->win_lb_mode) |
|
||||
v_WIN0_RB_SWAP(win->swap_rb);
|
||||
v_WIN0_RB_SWAP(win->area[0].swap_rb);
|
||||
lcdc_msk_reg(lcdc_dev, WIN0_CTRL0+off, mask,val);
|
||||
|
||||
mask = m_WIN0_BIC_COE_SEL |
|
||||
|
|
@ -850,8 +854,9 @@ static int rk3288_win_2_3_reg_update(struct rk_lcdc_driver *dev_drv,int win_id)
|
|||
|
||||
if(win->state == 1){
|
||||
mask = m_WIN2_EN | m_WIN2_DATA_FMT | m_WIN2_RB_SWAP;
|
||||
val = v_WIN2_EN(1) | v_WIN2_DATA_FMT(win->fmt_cfg) |
|
||||
v_WIN2_RB_SWAP(win->swap_rb);
|
||||
val = v_WIN2_EN(1) |
|
||||
v_WIN2_DATA_FMT(win->area[0].fmt_cfg) |
|
||||
v_WIN2_RB_SWAP(win->area[0].swap_rb);
|
||||
lcdc_msk_reg(lcdc_dev,WIN2_CTRL0+off,mask,val);
|
||||
/*area 0*/
|
||||
if(win->area[0].state == 1){
|
||||
|
|
@ -1206,7 +1211,8 @@ static int rk3288_load_screen(struct rk_lcdc_driver *dev_drv, bool initscreen)
|
|||
}
|
||||
spin_unlock(&lcdc_dev->reg_lock);
|
||||
rk3288_lcdc_set_dclk(dev_drv);
|
||||
if (dev_drv->trsm_ops && dev_drv->trsm_ops->enable)
|
||||
if (screen->type != SCREEN_HDMI && dev_drv->trsm_ops &&
|
||||
dev_drv->trsm_ops->enable)
|
||||
dev_drv->trsm_ops->enable();
|
||||
if (screen->init)
|
||||
screen->init();
|
||||
|
|
@ -1597,8 +1603,7 @@ static int rk3288_lcdc_cal_scl_fac(struct rk_lcdc_win *win)
|
|||
yrgb_srcH = srcH;
|
||||
yrgb_dstW = dstW;
|
||||
yrgb_dstH = dstH;
|
||||
if ((yrgb_dstW >= yrgb_srcW*8) || (yrgb_dstH >= yrgb_srcH*8) ||
|
||||
(yrgb_dstW*8 <= yrgb_srcW) || (yrgb_dstH*8 <= yrgb_srcH)) {
|
||||
if ((yrgb_dstW*8 <= yrgb_srcW) || (yrgb_dstH*8 <= yrgb_srcH)) {
|
||||
pr_err("ERROR: yrgb scale exceed 8,"
|
||||
"srcW=%d,srcH=%d,dstW=%d,dstH=%d\n",
|
||||
yrgb_srcW,yrgb_srcH,yrgb_dstW,yrgb_dstH);
|
||||
|
|
@ -1620,7 +1625,7 @@ static int rk3288_lcdc_cal_scl_fac(struct rk_lcdc_win *win)
|
|||
}
|
||||
|
||||
/*cbcr scl mode*/
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case YUV422:
|
||||
case YUV422_A:
|
||||
cbcr_srcW = srcW/2;
|
||||
|
|
@ -1654,8 +1659,7 @@ static int rk3288_lcdc_cal_scl_fac(struct rk_lcdc_win *win)
|
|||
break;
|
||||
}
|
||||
if (yuv_fmt) {
|
||||
if ((cbcr_dstW >= cbcr_srcW*8) || (cbcr_dstH >= cbcr_srcH*8) ||
|
||||
(cbcr_dstW*8 <= cbcr_srcW)||(cbcr_dstH*8 <= cbcr_srcH)) {
|
||||
if ((cbcr_dstW*8 <= cbcr_srcW) || (cbcr_dstH*8 <= cbcr_srcH)) {
|
||||
pr_err("ERROR: cbcr scale exceed 8,"
|
||||
"srcW=%d,srcH=%d,dstW=%d,dstH=%d\n",
|
||||
cbcr_srcW,cbcr_srcH,cbcr_dstW,cbcr_dstH);
|
||||
|
|
@ -1686,14 +1690,17 @@ static int rk3288_lcdc_cal_scl_fac(struct rk_lcdc_win *win)
|
|||
win->cbr_hor_scl_mode,win->cbr_ver_scl_mode);
|
||||
|
||||
/*line buffer mode*/
|
||||
if((win->format == YUV422) || (win->format == YUV420) || (win->format == YUV422_A) || (win->format == YUV420_A)){
|
||||
if(win->cbr_hor_scl_mode == SCALE_DOWN){
|
||||
if ((win->area[0].format == YUV422) ||
|
||||
(win->area[0].format == YUV420) ||
|
||||
(win->area[0].format == YUV422_A) ||
|
||||
(win->area[0].format == YUV420_A)) {
|
||||
if (win->cbr_hor_scl_mode == SCALE_DOWN) {
|
||||
if ((cbcr_dstW > 3840) || (cbcr_dstW == 0)) {
|
||||
pr_err("ERROR cbcr_dstW = %d\n",cbcr_dstW);
|
||||
}else if(cbcr_dstW > 2560){
|
||||
} else if (cbcr_dstW > 2560) {
|
||||
win->win_lb_mode = LB_RGB_3840X2;
|
||||
}else if(cbcr_dstW > 1920){
|
||||
if(win->yrgb_hor_scl_mode == SCALE_DOWN){
|
||||
} else if (cbcr_dstW > 1920) {
|
||||
if (win->yrgb_hor_scl_mode == SCALE_DOWN) {
|
||||
if(yrgb_dstW > 3840){
|
||||
pr_err("ERROR yrgb_dst_width exceeds 3840\n");
|
||||
}else if(yrgb_dstW > 2560){
|
||||
|
|
@ -1703,13 +1710,13 @@ static int rk3288_lcdc_cal_scl_fac(struct rk_lcdc_win *win)
|
|||
}else{
|
||||
pr_err("ERROR never run here!yrgb_dstW<1920 ==> cbcr_dstW>1920\n");
|
||||
}
|
||||
}
|
||||
}else if(cbcr_dstW > 1280){
|
||||
}
|
||||
} else if (cbcr_dstW > 1280) {
|
||||
win->win_lb_mode = LB_YUV_3840X5;
|
||||
}else{
|
||||
} else {
|
||||
win->win_lb_mode = LB_YUV_2560X8;
|
||||
}
|
||||
} else { /*SCALE_UP or SCALE_NONE*/
|
||||
} else { /*SCALE_UP or SCALE_NONE*/
|
||||
if ((cbcr_srcW > 3840) || (cbcr_srcW == 0)) {
|
||||
pr_err("ERROR cbcr_srcW = %d\n",cbcr_srcW);
|
||||
}else if(cbcr_srcW > 2560){
|
||||
|
|
@ -1989,7 +1996,7 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
struct rk_screen *screen, struct rk_lcdc_win *win)
|
||||
{
|
||||
u32 xact,yact,xvir, yvir,xpos, ypos;
|
||||
u8 fmt_cfg = 0;
|
||||
u8 fmt_cfg = 0, swap_rb;
|
||||
char fmt[9] = "NULL";
|
||||
|
||||
xpos = win->area[0].xpos + screen->mode.left_margin + screen->mode.hsync_len;
|
||||
|
|
@ -1998,55 +2005,55 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
spin_lock(&lcdc_dev->reg_lock);
|
||||
if(likely(lcdc_dev->clk_on)){
|
||||
rk3288_lcdc_cal_scl_fac(win);/*fac,lb,gt2,gt4*/
|
||||
switch (win->format){
|
||||
switch (win->area[0].format) {
|
||||
case ARGB888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 1;
|
||||
swap_rb = 1;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case RGB888:
|
||||
fmt_cfg = 1;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
fmt_cfg = 2;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV422:
|
||||
fmt_cfg = 5;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV420:
|
||||
fmt_cfg = 4;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV444:
|
||||
fmt_cfg = 6;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
case YUV422_A:
|
||||
fmt_cfg = 5;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 1;
|
||||
break;
|
||||
case YUV420_A:
|
||||
fmt_cfg = 4;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 1;
|
||||
break;
|
||||
case YUV444_A:
|
||||
fmt_cfg = 6;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 1;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2054,7 +2061,8 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
__func__);
|
||||
break;
|
||||
}
|
||||
win->fmt_cfg = fmt_cfg;
|
||||
win->area[0].fmt_cfg = fmt_cfg;
|
||||
win->area[0].swap_rb = swap_rb;
|
||||
win->area[0].dsp_stx = xpos;
|
||||
win->area[0].dsp_sty = ypos;
|
||||
xact = win->area[0].xact;
|
||||
|
|
@ -2067,7 +2075,7 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
|
||||
DBG(1, "lcdc%d>>%s\n>>format:%s>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d\n"
|
||||
">>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", lcdc_dev->id,
|
||||
__func__, get_format_string(win->format, fmt), xact,
|
||||
__func__, get_format_string(win->area[0].format, fmt), xact,
|
||||
yact, win->area[0].xsize, win->area[0].ysize, xvir, yvir, xpos, ypos);
|
||||
return 0;
|
||||
|
||||
|
|
@ -2076,66 +2084,66 @@ static int win0_set_par(struct lcdc_device *lcdc_dev,
|
|||
static int win1_set_par(struct lcdc_device *lcdc_dev,
|
||||
struct rk_screen *screen, struct rk_lcdc_win *win)
|
||||
{
|
||||
u32 xact,yact,xvir, yvir,xpos, ypos;
|
||||
u8 fmt_cfg = 0;
|
||||
u32 xact, yact, xvir, yvir, xpos, ypos;
|
||||
u8 fmt_cfg = 0, swap_rb;
|
||||
char fmt[9] = "NULL";
|
||||
|
||||
xpos = win->area[0].xpos + screen->mode.left_margin + screen->mode.hsync_len;
|
||||
ypos = win->area[0].ypos + screen->mode.upper_margin + screen->mode.vsync_len;
|
||||
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
if(likely(lcdc_dev->clk_on)){
|
||||
if (likely(lcdc_dev->clk_on)) {
|
||||
rk3288_lcdc_cal_scl_fac(win);/*fac,lb,gt2,gt4*/
|
||||
switch (win->format){
|
||||
switch (win->area[0].format) {
|
||||
case ARGB888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 1;
|
||||
swap_rb = 1;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case RGB888:
|
||||
fmt_cfg = 1;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
fmt_cfg = 2;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV422:
|
||||
fmt_cfg = 5;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV420:
|
||||
fmt_cfg = 4;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV444:
|
||||
fmt_cfg = 6;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 0;
|
||||
break;
|
||||
case YUV422_A:
|
||||
fmt_cfg = 5;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 1;
|
||||
break;
|
||||
case YUV420_A:
|
||||
fmt_cfg = 4;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 1;
|
||||
break;
|
||||
case YUV444_A:
|
||||
fmt_cfg = 6;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
win->fmt_10 = 1;
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2143,7 +2151,8 @@ static int win1_set_par(struct lcdc_device *lcdc_dev,
|
|||
__func__);
|
||||
break;
|
||||
}
|
||||
win->fmt_cfg = fmt_cfg;
|
||||
win->area[0].fmt_cfg = fmt_cfg;
|
||||
win->area[0].swap_rb = swap_rb;
|
||||
win->area[0].dsp_stx = xpos;
|
||||
win->area[0].dsp_sty = ypos;
|
||||
xact = win->area[0].xact;
|
||||
|
|
@ -2156,7 +2165,7 @@ static int win1_set_par(struct lcdc_device *lcdc_dev,
|
|||
|
||||
DBG(1, "lcdc%d>>%s\n>>format:%s>>>xact:%d>>yact:%d>>xsize:%d>>ysize:%d\n"
|
||||
">>xvir:%d>>yvir:%d>>xpos:%d>>ypos:%d>>\n", lcdc_dev->id,
|
||||
__func__, get_format_string(win->format, fmt), xact,
|
||||
__func__, get_format_string(win->area[0].format, fmt), xact,
|
||||
yact, win->area[0].xsize, win->area[0].ysize, xvir, yvir, xpos, ypos);
|
||||
return 0;
|
||||
|
||||
|
|
@ -2166,28 +2175,28 @@ static int win2_set_par(struct lcdc_device *lcdc_dev,
|
|||
struct rk_screen *screen, struct rk_lcdc_win *win)
|
||||
{
|
||||
int i;
|
||||
u8 fmt_cfg;
|
||||
u8 fmt_cfg, swap_rb;
|
||||
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
if(likely(lcdc_dev->clk_on)){
|
||||
for(i=0;i<win->area_num;i++){
|
||||
switch (win->format){
|
||||
if (likely(lcdc_dev->clk_on)) {
|
||||
for (i = 0; i < win->area_num; i++) {
|
||||
switch (win->area[i].format) {
|
||||
case ARGB888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
break;
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 1;
|
||||
swap_rb = 1;
|
||||
break;
|
||||
case RGB888:
|
||||
fmt_cfg = 1;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
fmt_cfg = 2;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
break;
|
||||
default:
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
|
|
@ -2195,7 +2204,8 @@ static int win2_set_par(struct lcdc_device *lcdc_dev,
|
|||
__func__);
|
||||
break;
|
||||
}
|
||||
win->fmt_cfg = fmt_cfg;
|
||||
win->area[i].fmt_cfg = fmt_cfg;
|
||||
win->area[i].swap_rb = swap_rb;
|
||||
win->area[i].dsp_stx = win->area[i].xpos +
|
||||
screen->mode.left_margin +
|
||||
screen->mode.hsync_len;
|
||||
|
|
@ -2222,28 +2232,28 @@ static int win3_set_par(struct lcdc_device *lcdc_dev,
|
|||
|
||||
{
|
||||
int i;
|
||||
u8 fmt_cfg;
|
||||
u8 fmt_cfg, swap_rb;
|
||||
|
||||
spin_lock(&lcdc_dev->reg_lock);
|
||||
if(likely(lcdc_dev->clk_on)){
|
||||
for(i=0;i<win->area_num;i++){
|
||||
switch (win->format){
|
||||
if (likely(lcdc_dev->clk_on)) {
|
||||
for (i = 0; i < win->area_num; i++) {
|
||||
switch (win->area[i].format) {
|
||||
case ARGB888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
break;
|
||||
case XBGR888:
|
||||
case ABGR888:
|
||||
fmt_cfg = 0;
|
||||
win->swap_rb = 1;
|
||||
swap_rb = 1;
|
||||
break;
|
||||
case RGB888:
|
||||
fmt_cfg = 1;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
break;
|
||||
case RGB565:
|
||||
fmt_cfg = 2;
|
||||
win->swap_rb = 0;
|
||||
swap_rb = 0;
|
||||
break;
|
||||
default:
|
||||
dev_err(lcdc_dev->driver.dev,
|
||||
|
|
@ -2251,7 +2261,8 @@ static int win3_set_par(struct lcdc_device *lcdc_dev,
|
|||
__func__);
|
||||
break;
|
||||
}
|
||||
win->fmt_cfg = fmt_cfg;
|
||||
win->area[i].fmt_cfg = fmt_cfg;
|
||||
win->area[i].swap_rb = swap_rb;
|
||||
win->area[i].dsp_stx = win->area[i].xpos +
|
||||
screen->mode.left_margin +
|
||||
screen->mode.hsync_len;
|
||||
|
|
|
|||
|
|
@ -891,10 +891,10 @@
|
|||
|
||||
#define HWC_MST (0x0158)
|
||||
#define HWC_DSP_ST (0x015c)
|
||||
#define v_HWC_DSP_XST3(x) (((x)&0x1fff)<<0)
|
||||
#define v_HWC_DSP_YST3(x) (((x)&0x1fff)<<16)
|
||||
#define m_HWC_DSP_XST3 (0x1fff<<0)
|
||||
#define m_HWC_DSP_YST3 (0x1fff<<16)
|
||||
#define v_HWC_DSP_XST(x) (((x)&0x1fff)<<0)
|
||||
#define v_HWC_DSP_YST(x) (((x)&0x1fff)<<16)
|
||||
#define m_HWC_DSP_XST (0x1fff<<0)
|
||||
#define m_HWC_DSP_YST (0x1fff<<16)
|
||||
|
||||
#define HWC_SRC_ALPHA_CTRL (0x0160)
|
||||
#define v_HWC_SRC_ALPHA_EN(x) (((x)&1)<<0)
|
||||
|
|
@ -1350,8 +1350,8 @@ struct alpha_config{
|
|||
|
||||
struct lcdc_cabc_mode {
|
||||
u32 pixel_num; /* pixel precent number */
|
||||
char stage_up; /* up stride */
|
||||
char stage_down; /* down stride */
|
||||
u16 stage_up; /* up stride */
|
||||
u16 stage_down; /* down stride */
|
||||
};
|
||||
|
||||
static inline void lcdc_writel(struct lcdc_device *lcdc_dev,u32 offset,u32 v)
|
||||
|
|
|
|||
|
|
@ -31,6 +31,8 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <linux/regulator/consumer.h>
|
||||
|
||||
#include "bmp_helper.h"
|
||||
|
||||
#if defined(CONFIG_RK_HDMI)
|
||||
#include "hdmi/rk_hdmi.h"
|
||||
#endif
|
||||
|
|
@ -65,6 +67,16 @@ int (*video_data_to_mirroring) (struct fb_info *info, u32 yuv_phy[2]);
|
|||
EXPORT_SYMBOL(video_data_to_mirroring);
|
||||
#endif
|
||||
|
||||
static uint32_t kernel_logo_addr;
|
||||
static int __init kernel_logo_setup(char *str)
|
||||
{
|
||||
if(str) {
|
||||
sscanf(str, "%x", &kernel_logo_addr);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
early_param("kernel_logo", kernel_logo_setup);
|
||||
static struct rk_fb_trsm_ops *trsm_lvds_ops;
|
||||
static struct rk_fb_trsm_ops *trsm_edp_ops;
|
||||
static struct rk_fb_trsm_ops *trsm_mipi_ops;
|
||||
|
|
@ -215,6 +227,9 @@ static int rk_fb_data_fmt(int data_format, int bits_per_pixel)
|
|||
case 32:
|
||||
fb_data_fmt = ARGB888;
|
||||
break;
|
||||
case 24:
|
||||
fb_data_fmt = RGB888;
|
||||
break;
|
||||
case 16:
|
||||
fb_data_fmt = RGB565;
|
||||
break;
|
||||
|
|
@ -830,6 +845,10 @@ static int get_extend_fb_id(struct fb_info *info)
|
|||
fb_id = 2;
|
||||
else if (!strcmp(id, "fb3") && (dev_drv->lcdc_win_num > 3))
|
||||
fb_id = 3;
|
||||
else if (!strcmp(id, "fb4") && (dev_drv->lcdc_win_num > 4))
|
||||
fb_id = 4;
|
||||
else
|
||||
dev_err(dev_drv->dev, "get_extend_fb_id info error\n");
|
||||
return fb_id;
|
||||
}
|
||||
|
||||
|
|
@ -1042,7 +1061,7 @@ static void rga_win_check(struct rk_lcdc_win *dst_win,
|
|||
{
|
||||
int format = 0;
|
||||
|
||||
format = get_rga_format(src_win->format);
|
||||
format = get_rga_format(src_win->area[0].format);
|
||||
/* width and height must be even number */
|
||||
if (format >= RK_FORMAT_YCbCr_422_SP &&
|
||||
format <= RK_FORMAT_YCrCb_420_P) {
|
||||
|
|
@ -1056,7 +1075,7 @@ static void rga_win_check(struct rk_lcdc_win *dst_win,
|
|||
if (src_win->area[0].yvir < src_win->area[0].yact)
|
||||
src_win->area[0].yvir = src_win->area[0].yact;
|
||||
|
||||
format = get_rga_format(dst_win->format);
|
||||
format = get_rga_format(dst_win->area[0].format);
|
||||
if (format >= RK_FORMAT_YCbCr_422_SP &&
|
||||
format <= RK_FORMAT_YCrCb_420_P) {
|
||||
if ((dst_win->area[0].xact % 2) != 0)
|
||||
|
|
@ -1136,7 +1155,7 @@ static void win_copy_by_rga(struct rk_lcdc_win *dst_win,
|
|||
|
||||
Rga_Request.src.vir_w = src_win->area[0].xvir;
|
||||
Rga_Request.src.vir_h = src_win->area[0].yvir;
|
||||
Rga_Request.src.format = get_rga_format(src_win->format);
|
||||
Rga_Request.src.format = get_rga_format(src_win->area[0].format);
|
||||
Rga_Request.src.act_w = src_win->area[0].xact;
|
||||
Rga_Request.src.act_h = src_win->area[0].yact;
|
||||
Rga_Request.src.x_offset = 0;
|
||||
|
|
@ -1144,7 +1163,7 @@ static void win_copy_by_rga(struct rk_lcdc_win *dst_win,
|
|||
|
||||
Rga_Request.dst.vir_w = dst_win->area[0].xvir;
|
||||
Rga_Request.dst.vir_h = dst_win->area[0].yvir;
|
||||
Rga_Request.dst.format = get_rga_format(dst_win->format);
|
||||
Rga_Request.dst.format = get_rga_format(dst_win->area[0].format);
|
||||
|
||||
Rga_Request.clip.xmin = 0;
|
||||
Rga_Request.clip.xmax = dst_win->area[0].xact - 1;
|
||||
|
|
@ -1209,9 +1228,9 @@ static int rk_fb_rotate(struct fb_info *dst_info,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int rk_fb_win_rotate(struct rk_lcdc_win *dst_win,
|
||||
struct rk_lcdc_win *src_win,
|
||||
u16 rotate, int iommu_en)
|
||||
static int __maybe_unused rk_fb_win_rotate(struct rk_lcdc_win *dst_win,
|
||||
struct rk_lcdc_win *src_win,
|
||||
u16 rotate, int iommu_en)
|
||||
{
|
||||
#if defined(CONFIG_ROCKCHIP_RGA) || defined(CONFIG_ROCKCHIP_RGA2)
|
||||
win_copy_by_rga(dst_win, src_win, rotate, iommu_en);
|
||||
|
|
@ -1242,7 +1261,7 @@ static int rk_fb_set_ext_win_buffer(struct rk_lcdc_win *ext_win,
|
|||
if (rk_fb->disp_mode != DUAL || ext_info == NULL)
|
||||
return 0;
|
||||
|
||||
switch (ext_win->format) {
|
||||
switch (ext_win->area[0].format) {
|
||||
case YUV422:
|
||||
case YUV420:
|
||||
case YUV444:
|
||||
|
|
@ -1376,13 +1395,13 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var,
|
|||
extend_win = extend_dev_drv->win[extend_win_id];
|
||||
}
|
||||
|
||||
pixel_width = rk_fb_pixel_width(win->format);
|
||||
pixel_width = rk_fb_pixel_width(win->area[0].format);
|
||||
vir_width_bit = pixel_width * xvir;
|
||||
/* pixel_width = byte_num * 8 */
|
||||
stride_32bit_1 = ALIGN_N_TIMES(vir_width_bit, 32) / 8;
|
||||
stride_32bit_2 = ALIGN_N_TIMES(vir_width_bit * 2, 32) / 8;
|
||||
|
||||
switch (win->format) {
|
||||
switch (win->area[0].format) {
|
||||
case YUV422:
|
||||
case YUV422_A:
|
||||
is_pic_yuv = 1;
|
||||
|
|
@ -1490,6 +1509,9 @@ static int rk_fb_pan_display(struct fb_var_screeninfo *var,
|
|||
video_data_to_mirroring(info, NULL);
|
||||
#endif
|
||||
dev_drv->ops->cfg_done(dev_drv);
|
||||
/*msleep(1000);
|
||||
dev_drv->ops->dump_reg(dev_drv);
|
||||
while(1);*/
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1662,15 +1684,19 @@ static int rk_fb_update_ext_win(struct rk_lcdc_driver *ext_dev_drv,
|
|||
}
|
||||
|
||||
ext_win->area[0].state = win->area[0].state;
|
||||
ext_win->area[0].format = win->area[0].format;
|
||||
ext_win->area_num = win->area_num;
|
||||
ext_win->format = win->format;
|
||||
ext_win->fmt_10 = win->fmt_10;
|
||||
ext_win->z_order = win->z_order;
|
||||
ext_win->alpha_en = win->alpha_en;
|
||||
ext_win->alpha_mode = win->alpha_mode;
|
||||
ext_win->g_alpha_val = win->g_alpha_val;
|
||||
ext_win->mirror_en = win->mirror_en;
|
||||
ext_win->area[0].fbdc_en = win->area[0].fbdc_en;
|
||||
ext_win->area[0].fbdc_cor_en = win->area[0].fbdc_cor_en;
|
||||
ext_win->area[0].fbdc_data_format = win->area[0].fbdc_data_format;
|
||||
|
||||
switch (ext_win->format) {
|
||||
switch (ext_win->area[0].format) {
|
||||
case YUV422:
|
||||
case YUV420:
|
||||
case YUV444:
|
||||
|
|
@ -1690,7 +1716,7 @@ static int rk_fb_update_ext_win(struct rk_lcdc_driver *ext_dev_drv,
|
|||
ext_win->area[0].xvir = win->area[0].yact;
|
||||
ext_win->area[0].yvir = win->area[0].xact;
|
||||
|
||||
pixel_width = rk_fb_pixel_width(ext_win->format);
|
||||
pixel_width = rk_fb_pixel_width(ext_win->area[0].format);
|
||||
vir_width_bit = pixel_width * ext_win->area[0].xvir;
|
||||
y_stride = ALIGN_N_TIMES(vir_width_bit, 32) / 8;
|
||||
ext_win->area[0].y_vir_stride = y_stride >> 2;
|
||||
|
|
@ -1786,14 +1812,12 @@ static void rk_fb_update_win(struct rk_lcdc_driver *dev_drv,
|
|||
rk_fb_get_prmry_screen(&primary_screen);
|
||||
|
||||
win->area_num = reg_win_data->area_num;
|
||||
win->format = reg_win_data->data_format;
|
||||
win->id = reg_win_data->win_id;
|
||||
win->z_order = reg_win_data->z_order;
|
||||
|
||||
if (reg_win_data->reg_area_data[0].smem_start > 0) {
|
||||
win->state = 1;
|
||||
win->area_num = reg_win_data->area_num;
|
||||
win->format = reg_win_data->data_format;
|
||||
win->id = reg_win_data->win_id;
|
||||
win->z_order = reg_win_data->z_order;
|
||||
win->area[0].uv_vir_stride =
|
||||
|
|
@ -1804,8 +1828,17 @@ static void rk_fb_update_win(struct rk_lcdc_driver *dev_drv,
|
|||
win->alpha_en = reg_win_data->alpha_en;
|
||||
win->alpha_mode = reg_win_data->alpha_mode;
|
||||
win->g_alpha_val = reg_win_data->g_alpha_val;
|
||||
win->mirror_en = reg_win_data->mirror_en;
|
||||
win->area[0].fbdc_en =
|
||||
reg_win_data->reg_area_data[0].fbdc_en;
|
||||
win->area[0].fbdc_cor_en =
|
||||
reg_win_data->reg_area_data[0].fbdc_cor_en;
|
||||
win->area[0].fbdc_data_format =
|
||||
reg_win_data->reg_area_data[0].fbdc_data_format;
|
||||
for (i = 0; i < RK_WIN_MAX_AREA; i++) {
|
||||
if (reg_win_data->reg_area_data[i].smem_start > 0) {
|
||||
win->area[i].format =
|
||||
reg_win_data->reg_area_data[i].data_format;
|
||||
if (inf->disp_policy != DISPLAY_POLICY_BOX)
|
||||
win->area[i].ion_hdl =
|
||||
reg_win_data->reg_area_data[i].ion_handle;
|
||||
|
|
@ -1866,6 +1899,10 @@ static void rk_fb_update_win(struct rk_lcdc_driver *dev_drv,
|
|||
reg_win_data->reg_area_data[i].xvir;
|
||||
win->area[i].yvir =
|
||||
reg_win_data->reg_area_data[i].yvir;
|
||||
win->area[i].xoff =
|
||||
reg_win_data->reg_area_data[i].xoff;
|
||||
win->area[i].yoff =
|
||||
reg_win_data->reg_area_data[i].yoff;
|
||||
win->area[i].y_offset =
|
||||
reg_win_data->reg_area_data[i].y_offset;
|
||||
win->area[i].y_vir_stride =
|
||||
|
|
@ -1905,8 +1942,10 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv,
|
|||
struct rk_lcdc_win *win;
|
||||
ktime_t timestamp = dev_drv->vsync_info.timestamp;
|
||||
struct rk_fb *rk_fb = platform_get_drvdata(fb_pdev);
|
||||
#if defined(CONFIG_RK_HDMI)
|
||||
struct rk_lcdc_driver *ext_dev_drv;
|
||||
struct rk_lcdc_win *ext_win;
|
||||
#endif
|
||||
struct rk_fb_reg_win_data *win_data;
|
||||
bool wait_for_vsync;
|
||||
int count = 100;
|
||||
|
|
@ -1929,8 +1968,8 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv,
|
|||
win_data = rk_fb_get_win_data(regs, i);
|
||||
if (win_data) {
|
||||
if (rk_fb->disp_policy == DISPLAY_POLICY_BOX &&
|
||||
(win_data->data_format == YUV420 ||
|
||||
win_data->data_format == YUV420_A))
|
||||
(win_data->reg_area_data[0].data_format == YUV420 ||
|
||||
win_data->reg_area_data[0].data_format == YUV420_A))
|
||||
continue;
|
||||
mutex_lock(&dev_drv->win_config);
|
||||
rk_fb_update_win(dev_drv, win, win_data);
|
||||
|
|
@ -1952,6 +1991,7 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv,
|
|||
dev_drv->ops->ovl_mgr(dev_drv, 0, 1);
|
||||
if (rk_fb->disp_policy == DISPLAY_POLICY_BOX)
|
||||
dev_drv->ops->cfg_done(dev_drv);
|
||||
#if defined(CONFIG_RK_HDMI)
|
||||
if ((rk_fb->disp_mode == DUAL)
|
||||
&& (hdmi_get_hotplug() == HDMI_HPD_ACTIVED)
|
||||
&& hdmi_switch_complete) {
|
||||
|
|
@ -1990,6 +2030,7 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv,
|
|||
ext_dev_drv->ops->cfg_done(ext_dev_drv);
|
||||
}
|
||||
ext_win_exit:
|
||||
#endif
|
||||
dev_drv->ops->cfg_done(dev_drv);
|
||||
|
||||
do {
|
||||
|
|
@ -1997,6 +2038,7 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv,
|
|||
timeout = wait_event_interruptible_timeout(dev_drv->vsync_info.wait,
|
||||
ktime_compare(dev_drv->vsync_info.timestamp, timestamp) > 0,
|
||||
msecs_to_jiffies(25));
|
||||
#if defined(CONFIG_RK_HDMI)
|
||||
if ((rk_fb->disp_mode == DUAL) &&
|
||||
(hdmi_get_hotplug() == HDMI_HPD_ACTIVED) &&
|
||||
hdmi_switch_complete) {
|
||||
|
|
@ -2009,14 +2051,14 @@ static void rk_fb_update_reg(struct rk_lcdc_driver *dev_drv,
|
|||
ktime_compare(ext_dev_drv->vsync_info.timestamp, timestamp) > 0,
|
||||
msecs_to_jiffies(25));
|
||||
}
|
||||
|
||||
#endif
|
||||
dev_drv->ops->get_dsp_addr(dev_drv, dsp_addr);
|
||||
wait_for_vsync = false;
|
||||
for (i = 0; i < dev_drv->lcdc_win_num; i++) {
|
||||
if (dev_drv->win[i]->state == 1) {
|
||||
if (rk_fb->disp_policy == DISPLAY_POLICY_BOX &&
|
||||
(dev_drv->win[i]->format == YUV420 ||
|
||||
dev_drv->win[i]->format == YUV420_A ||
|
||||
(dev_drv->win[i]->area[0].format == YUV420 ||
|
||||
dev_drv->win[i]->area[0].format == YUV420_A ||
|
||||
!strcmp(dev_drv->win[i]->name, "hwc"))) {
|
||||
continue;
|
||||
} else {
|
||||
|
|
@ -2133,7 +2175,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
struct rk_lcdc_driver *dev_drv = fb_par->lcdc_drv;
|
||||
struct rk_screen *screen = dev_drv->cur_screen;
|
||||
struct rk_screen primary_screen;
|
||||
struct fb_info *fbi = rk_fb->fb[0];
|
||||
struct fb_info *fbi;
|
||||
int i, ion_fd, acq_fence_fd;
|
||||
u32 xvir, yvir;
|
||||
u32 xoffset, yoffset;
|
||||
|
|
@ -2164,9 +2206,8 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
ion_import_dma_buf(rk_fb->ion_client,
|
||||
ion_fd);
|
||||
if (IS_ERR(hdl)) {
|
||||
pr_info
|
||||
("%s: Could not import handle: %d\n",
|
||||
__func__, (int)hdl);
|
||||
pr_info("%s: Could not import handle:"
|
||||
" %ld\n", __func__, (long)hdl);
|
||||
/*return -EINVAL; */
|
||||
break;
|
||||
}
|
||||
|
|
@ -2216,16 +2257,6 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
sync_fence_fdget(win_par->area_par[i].acq_fence_fd);
|
||||
}
|
||||
}
|
||||
fb_data_fmt = rk_fb_data_fmt(win_par->data_format, 0);
|
||||
reg_win_data->data_format = fb_data_fmt;
|
||||
pixel_width = rk_fb_pixel_width(fb_data_fmt);
|
||||
|
||||
ppixel_a = ((fb_data_fmt == ARGB888) ||
|
||||
(fb_data_fmt == ABGR888)) ? 1 : 0;
|
||||
global_a = (win_par->g_alpha_val == 0) ? 0 : 1;
|
||||
reg_win_data->alpha_en = ppixel_a | global_a;
|
||||
reg_win_data->g_alpha_val = win_par->g_alpha_val;
|
||||
reg_win_data->alpha_mode = win_par->alpha_mode;
|
||||
if (reg_win_data->reg_area_data[0].smem_start > 0) {
|
||||
reg_win_data->z_order = win_par->z_order;
|
||||
reg_win_data->win_id = win_par->win_id;
|
||||
|
|
@ -2235,11 +2266,24 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
}
|
||||
|
||||
rk_fb_get_prmry_screen(&primary_screen);
|
||||
reg_win_data->mirror_en = win_par->mirror_en;
|
||||
reg_win_data->reg_area_data[0].fbdc_en = win_par->area_par[0].fbdc_en;
|
||||
reg_win_data->reg_area_data[0].fbdc_cor_en =
|
||||
win_par->area_par[0].fbdc_cor_en;
|
||||
reg_win_data->reg_area_data[0].fbdc_data_format =
|
||||
win_par->area_par[0].fbdc_data_format;
|
||||
for (i = 0; i < reg_win_data->area_num; i++) {
|
||||
if (rk_fb->disp_policy == DISPLAY_POLICY_BOX)
|
||||
rk_fb_check_config_var(&win_par->area_par[i], screen);
|
||||
else
|
||||
rk_fb_check_config_var(&win_par->area_par[i], &primary_screen);
|
||||
|
||||
fb_data_fmt = rk_fb_data_fmt(win_par->area_par[i].data_format, 0);
|
||||
reg_win_data->reg_area_data[i].data_format = fb_data_fmt;
|
||||
pixel_width = rk_fb_pixel_width(fb_data_fmt);
|
||||
|
||||
ppixel_a |= ((fb_data_fmt == ARGB888) ||
|
||||
(fb_data_fmt == ABGR888)) ? 1 : 0;
|
||||
/* visiable pos in panel */
|
||||
reg_win_data->reg_area_data[i].xpos = win_par->area_par[i].xpos;
|
||||
reg_win_data->reg_area_data[i].ypos = win_par->area_par[i].ypos;
|
||||
|
|
@ -2254,6 +2298,9 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
|
||||
xoffset = win_par->area_par[i].x_offset; /* buf offset */
|
||||
yoffset = win_par->area_par[i].y_offset;
|
||||
reg_win_data->reg_area_data[i].xoff = xoffset;
|
||||
reg_win_data->reg_area_data[i].yoff = yoffset;
|
||||
|
||||
xvir = win_par->area_par[i].xvir;
|
||||
reg_win_data->reg_area_data[i].xvir = xvir;
|
||||
yvir = win_par->area_par[i].yvir;
|
||||
|
|
@ -2272,7 +2319,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
* reg_win_data->reg_area_data[i].y_offset =
|
||||
* yoffset*stride+xoffset*pixel_width/8;
|
||||
*/
|
||||
if (screen->y_mirror == 1) {
|
||||
if ((screen->y_mirror == 1) || (reg_win_data->mirror_en)) {
|
||||
if (screen->interlace == 1) {
|
||||
reg_win_data->reg_area_data[i].y_offset =
|
||||
yoffset * stride * 2 +
|
||||
|
|
@ -2296,6 +2343,12 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
global_a = (win_par->g_alpha_val == 0) ? 0 : 1;
|
||||
reg_win_data->alpha_en = ppixel_a | global_a;
|
||||
reg_win_data->g_alpha_val = win_par->g_alpha_val;
|
||||
reg_win_data->alpha_mode = win_par->alpha_mode;
|
||||
|
||||
switch (fb_data_fmt) {
|
||||
case YUV422:
|
||||
case YUV422_A:
|
||||
|
|
@ -2334,7 +2387,7 @@ static int rk_fb_set_win_buffer(struct fb_info *info,
|
|||
reg_win_data->reg_area_data[0].cbr_start =
|
||||
reg_win_data->reg_area_data[0].smem_start + xvir * yvir;
|
||||
reg_win_data->reg_area_data[0].uv_vir_stride = uv_stride >> 2;
|
||||
if (screen->y_mirror == 1) {
|
||||
if ((screen->y_mirror == 1) || (reg_win_data->mirror_en)) {
|
||||
if (screen->interlace == 1) {
|
||||
reg_win_data->reg_area_data[0].c_offset =
|
||||
uv_y_off * uv_stride * 2 +
|
||||
|
|
@ -2919,9 +2972,9 @@ static ssize_t rk_fb_read(struct fb_info *info, char __user *buf,
|
|||
win = dev_drv->win[win_id];
|
||||
|
||||
/* only read the current frame buffer */
|
||||
if (win->format == RGB565) {
|
||||
if (win->area[0].format == RGB565) {
|
||||
total_size = win->area[0].y_vir_stride * win->area[0].yact << 1;
|
||||
} else if (win->format == YUV420) {
|
||||
} else if (win->area[0].format == YUV420) {
|
||||
total_size =
|
||||
(win->area[0].y_vir_stride * win->area[0].yact * 6);
|
||||
} else {
|
||||
|
|
@ -2984,7 +3037,7 @@ static ssize_t rk_fb_write(struct fb_info *info, const char __user *buf,
|
|||
win = dev_drv->win[win_id];
|
||||
|
||||
/* write the current frame buffer */
|
||||
if (win->format == RGB565)
|
||||
if (win->area[0].format == RGB565)
|
||||
total_size = win->area[0].xact * win->area[0].yact << 1;
|
||||
else
|
||||
total_size = win->area[0].xact * win->area[0].yact << 2;
|
||||
|
|
@ -3258,7 +3311,7 @@ static int rk_fb_set_par(struct fb_info *info)
|
|||
}
|
||||
}
|
||||
|
||||
win->format = fb_data_fmt;
|
||||
win->area[0].format = fb_data_fmt;
|
||||
win->area[0].y_vir_stride = stride >> 2;
|
||||
win->area[0].uv_vir_stride = uv_stride >> 2;
|
||||
win->area[0].xpos = xpos;
|
||||
|
|
@ -3269,15 +3322,17 @@ static int rk_fb_set_par(struct fb_info *info)
|
|||
win->area[0].yact = var->yres;
|
||||
win->area[0].xvir = var->xres_virtual; /* virtual resolution stride --->LCDC_WINx_VIR */
|
||||
win->area[0].yvir = var->yres_virtual;
|
||||
win->area[0].xoff = xoffset;
|
||||
win->area[0].yoff = yoffset;
|
||||
|
||||
win->area_num = 1;
|
||||
win->alpha_mode = 4; /* AB_SRC_OVER; */
|
||||
win->alpha_en = ((win->format == ARGB888) ||
|
||||
(win->format == ABGR888)) ? 1 : 0;
|
||||
win->alpha_en = ((win->area[0].format == ARGB888) ||
|
||||
(win->area[0].format == ABGR888)) ? 1 : 0;
|
||||
win->g_alpha_val = 0;
|
||||
|
||||
if (rk_fb->disp_policy == DISPLAY_POLICY_BOX &&
|
||||
(win->format == YUV420 || win->format == YUV420_A))
|
||||
(win->area[0].format == YUV420 || win->area[0].format == YUV420_A))
|
||||
win->state = 1;
|
||||
if (rk_fb->disp_mode == DUAL) {
|
||||
if (extend_win->state && hdmi_switch_complete) {
|
||||
|
|
@ -3527,6 +3582,9 @@ int rk_fb_switch_screen(struct rk_screen *screen, int enable, int lcdc_id)
|
|||
dev_drv->ops->dsp_black(dev_drv, 1);
|
||||
if (dev_drv->ops->set_screen_scaler)
|
||||
dev_drv->ops->set_screen_scaler(dev_drv, dev_drv->screen0, 0);
|
||||
} else if ((rk_fb->disp_mode == NO_DUAL) && (enable)) {
|
||||
if (dev_drv->ops->dsp_black)
|
||||
dev_drv->ops->dsp_black(dev_drv, 1);
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
|
|
@ -3535,7 +3593,8 @@ int rk_fb_switch_screen(struct rk_screen *screen, int enable, int lcdc_id)
|
|||
return 0;
|
||||
|
||||
/* if used one lcdc to dual disp, no need to close win */
|
||||
if (rk_fb->disp_mode == ONE_DUAL) {
|
||||
if ((rk_fb->disp_mode == ONE_DUAL) ||
|
||||
(rk_fb->disp_mode == NO_DUAL)) {
|
||||
dev_drv->cur_screen = dev_drv->screen0;
|
||||
dev_drv->ops->load_screen(dev_drv, 1);
|
||||
|
||||
|
|
@ -3572,7 +3631,8 @@ int rk_fb_switch_screen(struct rk_screen *screen, int enable, int lcdc_id)
|
|||
dev_drv->cur_screen->x_mirror = dev_drv->rotate_mode & X_MIRROR;
|
||||
dev_drv->cur_screen->y_mirror = dev_drv->rotate_mode & Y_MIRROR;
|
||||
}
|
||||
if (!dev_drv->uboot_logo) {
|
||||
if ((!dev_drv->uboot_logo) ||
|
||||
(rk_fb->disp_policy != DISPLAY_POLICY_BOX)) {
|
||||
for (i = 0; i < dev_drv->lcdc_win_num; i++) {
|
||||
info = rk_fb->fb[dev_drv->fb_index_base + i];
|
||||
fb_par = (struct rk_fb_par *)info->par;
|
||||
|
|
@ -3596,7 +3656,8 @@ int rk_fb_switch_screen(struct rk_screen *screen, int enable, int lcdc_id)
|
|||
info->var.activate |= FB_ACTIVATE_FORCE;
|
||||
if (rk_fb->disp_mode == DUAL) {
|
||||
rk_fb_update_ext_info(info, pmy_info, 1);
|
||||
} else if (rk_fb->disp_mode == ONE_DUAL) {
|
||||
} else if ((rk_fb->disp_mode == ONE_DUAL) ||
|
||||
(rk_fb->disp_mode == NO_DUAL)) {
|
||||
info->var.grayscale &= 0xff;
|
||||
info->var.grayscale |=
|
||||
(dev_drv->cur_screen->xsize << 8) +
|
||||
|
|
@ -4116,15 +4177,40 @@ int rk_fb_register(struct rk_lcdc_driver *dev_drv,
|
|||
|
||||
rk_fb_alloc_buffer(main_fbi, 0); /* only alloc memory for main fb */
|
||||
dev_drv->uboot_logo = support_uboot_display();
|
||||
#if !defined(CONFIG_LOGO)
|
||||
if (support_uboot_display()) {
|
||||
/*
|
||||
if (dev_drv->iommu_enabled)
|
||||
rk_fb_copy_from_loader(main_fbi);
|
||||
*/
|
||||
|
||||
if (kernel_logo_addr) {
|
||||
struct rk_lcdc_win *win = dev_drv->win[0];
|
||||
char *addr = phys_to_virt(kernel_logo_addr);
|
||||
int width, height, bits;
|
||||
|
||||
bmpdecoder(addr, main_fbi->screen_base,
|
||||
&width, &height, &bits);
|
||||
win->area[0].format = rk_fb_data_fmt(0, bits);
|
||||
win->area[0].y_vir_stride = width * bits >> 5;
|
||||
win->area[0].xpos = (main_fbi->var.xres - width) >> 1;
|
||||
win->area[0].ypos = (main_fbi->var.yres - height) >> 1;;
|
||||
win->area[0].xsize = width;
|
||||
win->area[0].ysize = height;
|
||||
win->area[0].xact = width;
|
||||
win->area[0].yact = height;
|
||||
win->area[0].xvir = win->area[0].y_vir_stride;
|
||||
win->area[0].yvir = height;
|
||||
win->area[0].smem_start = main_fbi->fix.smem_start;
|
||||
win->area[0].y_offset = 0;
|
||||
|
||||
win->area_num = 1;
|
||||
win->alpha_mode = 4;
|
||||
win->alpha_en = 0;
|
||||
win->g_alpha_val = 0;
|
||||
|
||||
win->state = 1;
|
||||
dev_drv->ops->set_par(dev_drv, 0);
|
||||
dev_drv->ops->pan_display(dev_drv, 0);
|
||||
dev_drv->ops->cfg_done(dev_drv);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
#if defined(CONFIG_LOGO)
|
||||
main_fbi->fbops->fb_set_par(main_fbi);
|
||||
#if defined(CONFIG_LOGO_LINUX_BMP)
|
||||
if (fb_prewine_bmp_logo(main_fbi, FB_ROTATE_UR)) {
|
||||
|
|
|
|||
|
|
@ -166,7 +166,8 @@ static int dump_win(struct rk_fb *rk_fb, struct rk_fb_reg_area_data *area_data,
|
|||
set_fs(KERNEL_DS);
|
||||
|
||||
if (is_bmp)
|
||||
datatobmp(vaddr, width, height, data_format, filp, fill_buffer);
|
||||
bmpencoder(vaddr, width, height,
|
||||
data_format, filp, fill_buffer);
|
||||
else
|
||||
fill_buffer(filp, vaddr, width * height * 4);
|
||||
|
||||
|
|
@ -233,7 +234,8 @@ static ssize_t set_dump_info(struct device *dev, struct device_attribute *attr,
|
|||
for (j = 0; j < RK_WIN_MAX_AREA; j++) {
|
||||
win_data = &front_regs->reg_win_data[i];
|
||||
if (dump_win(rk_fb, &win_data->reg_area_data[j],
|
||||
win_data->data_format, i, j, is_img))
|
||||
win_data->reg_area_data[i].data_format,i,
|
||||
j, is_img))
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#define OUT_CCIR656 6
|
||||
#define OUT_S888 8
|
||||
#define OUT_S888DUMY 12
|
||||
#define OUT_YUV_420 14
|
||||
#define OUT_P16BPP4 24
|
||||
#define OUT_D888_P666 0x21 //18bit screen,connect to lcdc D2~D7, D10~D15, D18~D23
|
||||
#define OUT_D888_P565 0x22
|
||||
|
|
@ -57,7 +58,8 @@
|
|||
#define FB0_WIN0_FB1_WIN2_FB2_WIN1 120
|
||||
#define FB0_WIN0_FB1_WIN1_FB2_WIN2 210
|
||||
#define FB0_WIN1_FB1_WIN0_FB2_WIN2 201
|
||||
#define FB0_WIN0_FB1_WIN1_FB2_WIN2_FB3_WIN3 3210
|
||||
#define FB0_WIN0_FB1_WIN1_FB2_WIN2_FB3_WIN3 3210
|
||||
#define FB0_WIN0_FB1_WIN1_FB2_WIN2_FB3_WIN3_FB4_HWC 43210
|
||||
|
||||
#define DISPLAY_POLICY_SDK 0
|
||||
#define DISPLAY_POLICY_BOX 1
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@
|
|||
#include <linux/kthread.h>
|
||||
|
||||
|
||||
#define RK30_MAX_LCDC_SUPPORT 4
|
||||
#define RK30_MAX_LAYER_SUPPORT 4
|
||||
#define RK_MAX_FB_SUPPORT 4
|
||||
#define RK30_MAX_LCDC_SUPPORT 2
|
||||
#define RK30_MAX_LAYER_SUPPORT 5
|
||||
#define RK_MAX_FB_SUPPORT 5
|
||||
#define RK_WIN_MAX_AREA 4
|
||||
#define RK_MAX_BUF_NUM 10
|
||||
#define RK_MAX_BUF_NUM 11
|
||||
|
||||
#define FB0_IOCTL_STOP_TIMER_FLUSH 0x6001
|
||||
#define FB0_IOCTL_SET_PANEL 0x6002
|
||||
|
|
@ -127,6 +127,7 @@ extern bool rk_fb_poll_wait_frame_complete(void);
|
|||
#define OUT_CCIR656 6
|
||||
#define OUT_S888 8
|
||||
#define OUT_S888DUMY 12
|
||||
#define OUT_YUV_420 14
|
||||
#define OUT_RGB_AAA 15
|
||||
#define OUT_P16BPP4 24
|
||||
#define OUT_D888_P666 0x21 //18bit screen,connect to lcdc D2~D7, D10~D15, D18~D23
|
||||
|
|
@ -293,7 +294,7 @@ typedef enum _TRSP_MODE {
|
|||
TRSP_INVAL
|
||||
} TRSP_MODE;
|
||||
|
||||
struct rk_lcdc_post_cfg{
|
||||
struct rk_lcdc_post_cfg {
|
||||
u32 xpos;
|
||||
u32 ypos;
|
||||
u32 xsize;
|
||||
|
|
@ -309,18 +310,23 @@ struct rk_lcdc_bcsh {
|
|||
u16 cos_hue;
|
||||
};
|
||||
|
||||
struct rk_lcdc_win_area{
|
||||
struct rk_lcdc_win_area {
|
||||
bool state;
|
||||
enum data_format format;
|
||||
u8 fmt_cfg;
|
||||
u8 swap_rb;
|
||||
u32 y_offset; /*yuv/rgb offset -->LCDC_WINx_YRGB_MSTx*/
|
||||
u32 c_offset; /*cb cr offset--->LCDC_WINx_CBR_MSTx*/
|
||||
u32 xpos; /*start point in panel --->LCDC_WINx_DSP_ST*/
|
||||
u32 ypos;
|
||||
u16 xpos; /*start point in panel --->LCDC_WINx_DSP_ST*/
|
||||
u16 ypos;
|
||||
u16 xsize; /* display window width/height -->LCDC_WINx_DSP_INFO*/
|
||||
u16 ysize;
|
||||
u16 xact; /*origin display window size -->LCDC_WINx_ACT_INFO*/
|
||||
u16 yact;
|
||||
u16 xvir; /*virtual width/height -->LCDC_WINx_VIR*/
|
||||
u16 yvir;
|
||||
u16 xoff; /*mem offset*/
|
||||
u16 yoff;
|
||||
unsigned long smem_start;
|
||||
unsigned long cbr_start; /*Cbr memory start address*/
|
||||
#if defined(CONFIG_ION_ROCKCHIP)
|
||||
|
|
@ -328,13 +334,26 @@ struct rk_lcdc_win_area{
|
|||
int dma_buf_fd;
|
||||
struct dma_buf *dma_buf;
|
||||
#endif
|
||||
u32 dsp_stx;
|
||||
u32 dsp_sty;
|
||||
u32 y_vir_stride;
|
||||
u32 uv_vir_stride;
|
||||
u16 dsp_stx;
|
||||
u16 dsp_sty;
|
||||
u16 y_vir_stride;
|
||||
u16 uv_vir_stride;
|
||||
u32 y_addr;
|
||||
u32 uv_addr;
|
||||
|
||||
u8 fbdc_en;
|
||||
u8 fbdc_cor_en;
|
||||
u8 fbdc_data_format;
|
||||
u8 fbdc_dsp_width_ratio;
|
||||
u8 fbdc_fmt_cfg;
|
||||
u16 fbdc_mb_vir_width;
|
||||
u16 fbdc_mb_vir_height;
|
||||
u16 fbdc_mb_width;
|
||||
u16 fbdc_mb_height;
|
||||
u16 fbdc_mb_xst;
|
||||
u16 fbdc_mb_yst;
|
||||
u16 fbdc_num_tiles;
|
||||
u16 fbdc_cmp_index_init;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -344,11 +363,8 @@ struct rk_lcdc_win {
|
|||
bool state; /*on or off*/
|
||||
bool last_state; /*on or off*/
|
||||
u32 pseudo_pal[16];
|
||||
enum data_format format;
|
||||
int z_order; /*win sel layer*/
|
||||
u8 fmt_cfg;
|
||||
u8 fmt_10;;
|
||||
u8 swap_rb;
|
||||
u8 fmt_10;
|
||||
u32 reserved;
|
||||
u32 area_num;
|
||||
u32 scale_yrgb_x;
|
||||
|
|
@ -376,8 +392,9 @@ struct rk_lcdc_win {
|
|||
u8 vsd_cbr_gt2;
|
||||
|
||||
u8 alpha_en;
|
||||
u32 alpha_mode;
|
||||
u32 g_alpha_val;
|
||||
u8 alpha_mode;
|
||||
u16 g_alpha_val;
|
||||
u8 mirror_en;
|
||||
u32 color_key_val;
|
||||
u8 csc_mode;
|
||||
|
||||
|
|
@ -444,55 +461,64 @@ struct rk_lcdc_drv_ops {
|
|||
};
|
||||
|
||||
struct rk_fb_area_par {
|
||||
int ion_fd;
|
||||
u8 data_format; /*layer data fmt*/
|
||||
short ion_fd;
|
||||
unsigned long phy_addr;
|
||||
int acq_fence_fd;
|
||||
u32 x_offset;
|
||||
u32 y_offset;
|
||||
u32 xpos; /*start point in panel --->LCDC_WINx_DSP_ST*/
|
||||
u32 ypos;
|
||||
u32 xsize; /* display window width/height -->LCDC_WINx_DSP_INFO*/
|
||||
u32 ysize;
|
||||
u32 xact; /*origin display window size -->LCDC_WINx_ACT_INFO*/
|
||||
u32 yact;
|
||||
u32 xvir; /*virtual width/height -->LCDC_WINx_VIR*/
|
||||
u32 yvir;
|
||||
short acq_fence_fd;
|
||||
u16 x_offset;
|
||||
u16 y_offset;
|
||||
u16 xpos; /*start point in panel --->LCDC_WINx_DSP_ST*/
|
||||
u16 ypos;
|
||||
u16 xsize; /* display window width/height -->LCDC_WINx_DSP_INFO*/
|
||||
u16 ysize;
|
||||
u16 xact; /*origin display window size -->LCDC_WINx_ACT_INFO*/
|
||||
u16 yact;
|
||||
u16 xvir; /*virtual width/height -->LCDC_WINx_VIR*/
|
||||
u16 yvir;
|
||||
u8 fbdc_en;
|
||||
u8 fbdc_cor_en;
|
||||
u8 fbdc_data_format;
|
||||
u16 reserved0;
|
||||
u32 reserved1;
|
||||
};
|
||||
|
||||
|
||||
struct rk_fb_win_par {
|
||||
u8 data_format; /*layer data fmt*/
|
||||
u8 win_id;
|
||||
u8 z_order; /*win sel layer*/
|
||||
u8 win_id;
|
||||
u8 z_order; /*win sel layer*/
|
||||
u8 alpha_mode;
|
||||
u16 g_alpha_val;
|
||||
u8 mirror_en;
|
||||
struct rk_fb_area_par area_par[RK_WIN_MAX_AREA];
|
||||
u32 alpha_mode;
|
||||
u32 g_alpha_val;
|
||||
u32 reserved0;
|
||||
};
|
||||
|
||||
struct rk_fb_win_cfg_data {
|
||||
int ret_fence_fd;
|
||||
int rel_fence_fd[RK_MAX_BUF_NUM];
|
||||
u8 wait_fs;
|
||||
short ret_fence_fd;
|
||||
short rel_fence_fd[RK_MAX_BUF_NUM];
|
||||
struct rk_fb_win_par win_par[RK30_MAX_LAYER_SUPPORT];
|
||||
struct rk_lcdc_post_cfg post_cfg;
|
||||
u8 wait_fs;
|
||||
//u8 fence_begin;
|
||||
};
|
||||
|
||||
struct rk_fb_reg_area_data {
|
||||
struct sync_fence *acq_fence;
|
||||
u8 data_format; /*layer data fmt*/
|
||||
u8 index_buf; /*judge if the buffer is index*/
|
||||
u32 y_offset; /*yuv/rgb offset -->LCDC_WINx_YRGB_MSTx*/
|
||||
u32 c_offset; /*cb cr offset--->LCDC_WINx_CBR_MSTx*/
|
||||
u32 y_vir_stride;
|
||||
u32 uv_vir_stride;
|
||||
u32 xpos; /*start point in panel --->LCDC_WINx_DSP_ST*/
|
||||
u32 ypos;
|
||||
u16 xpos; /*start point in panel --->LCDC_WINx_DSP_ST*/
|
||||
u16 ypos;
|
||||
u16 xsize; /* display window width/height -->LCDC_WINx_DSP_INFO*/
|
||||
u16 ysize;
|
||||
u16 xact; /*origin display window size -->LCDC_WINx_ACT_INFO*/
|
||||
u16 yact;
|
||||
u16 xvir; /*virtual width/height -->LCDC_WINx_VIR*/
|
||||
u16 yvir;
|
||||
u16 xoff; /*mem offset*/
|
||||
u16 yoff;
|
||||
unsigned long smem_start;
|
||||
unsigned long cbr_start; /*Cbr memory start address*/
|
||||
u32 line_length;
|
||||
|
|
@ -502,38 +528,38 @@ struct rk_fb_reg_area_data {
|
|||
struct dma_buf_attachment *attachment;
|
||||
struct sg_table *sg_table;
|
||||
dma_addr_t dma_addr;
|
||||
#endif
|
||||
#endif
|
||||
u8 fbdc_en;
|
||||
u8 fbdc_cor_en;
|
||||
u8 fbdc_data_format;
|
||||
};
|
||||
|
||||
struct rk_fb_reg_win_data {
|
||||
u8 data_format; /*layer data fmt*/
|
||||
u8 win_id;
|
||||
u8 z_order; /*win sel layer*/
|
||||
u32 area_num; /*maybe two region have the same dma buff,*/
|
||||
u32 area_buf_num; /*so area_num maybe not equal to area_buf_num*/
|
||||
u8 alpha_en;
|
||||
u32 alpha_mode;
|
||||
u32 g_alpha_val;
|
||||
u32 color_key_val;
|
||||
u8 alpha_mode;
|
||||
u16 g_alpha_val;
|
||||
u8 mirror_en;
|
||||
|
||||
struct rk_fb_reg_area_data reg_area_data[RK_WIN_MAX_AREA];
|
||||
};
|
||||
|
||||
struct rk_fb_reg_data {
|
||||
struct list_head list;
|
||||
int win_num;
|
||||
int buf_num;
|
||||
int acq_num;
|
||||
int win_num;
|
||||
int buf_num;
|
||||
int acq_num;
|
||||
struct rk_fb_reg_win_data reg_win_data[RK30_MAX_LAYER_SUPPORT];
|
||||
struct rk_lcdc_post_cfg post_cfg;
|
||||
//struct sync_fence *acq_fence[RK_MAX_BUF_NUM];
|
||||
//int fence_wait_begin;
|
||||
};
|
||||
|
||||
struct rk_lcdc_driver {
|
||||
char name[6];
|
||||
int id;
|
||||
int prop;
|
||||
int id;
|
||||
int prop;
|
||||
struct device *dev;
|
||||
|
||||
struct rk_lcdc_win *win[RK_MAX_FB_SUPPORT];
|
||||
|
|
@ -550,11 +576,12 @@ struct rk_lcdc_driver {
|
|||
u16 overlay_mode;
|
||||
u16 output_color;
|
||||
|
||||
u16 fb_win_map;
|
||||
u16 fb_win_map;
|
||||
char fb0_win_id;
|
||||
char fb1_win_id;
|
||||
char fb2_win_id;
|
||||
char fb3_win_id;
|
||||
char fb4_win_id;
|
||||
|
||||
char mmu_dts_name[40];
|
||||
struct device *mmu_dev;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user