mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 19:21:31 -04:00
Merge "Merge android-5.4.30 (5cfdde5) into msm-5.4"
This commit is contained in:
commit
16b8d19f54
762 changed files with 207958 additions and 172314 deletions
|
|
@ -510,6 +510,12 @@ config WIGIG_SENSING_SPI
|
|||
The output of the driver is CIRs (Channel Impulse Response) which
|
||||
must be processed in user space in order to get meaningful results.
|
||||
|
||||
config HISI_HIKEY_USB
|
||||
tristate "USB functionality of HiSilicon Hikey Platform"
|
||||
depends on OF && GPIOLIB
|
||||
help
|
||||
If you say yes here you get support for usb functionality of HiSilicon Hikey Platform.
|
||||
|
||||
source "drivers/misc/c2port/Kconfig"
|
||||
source "drivers/misc/eeprom/Kconfig"
|
||||
source "drivers/misc/cb710/Kconfig"
|
||||
|
|
|
|||
|
|
@ -63,3 +63,4 @@ obj-$(CONFIG_QSEECOM) += qseecom-mod.o
|
|||
qseecom-mod-y := qseecom.o
|
||||
qseecom-mod-$(CONFIG_COMPAT) += compat_qseecom.o
|
||||
obj-$(CONFIG_WIGIG_SENSING_SPI) += wigig_sensing.o
|
||||
obj-$(CONFIG_HISI_HIKEY_USB) += hisi_hikey_usb.o
|
||||
|
|
|
|||
|
|
@ -2112,8 +2112,8 @@ exit_done:
|
|||
return status;
|
||||
}
|
||||
|
||||
static int altera_get_note(u8 *p, s32 program_size,
|
||||
s32 *offset, char *key, char *value, int length)
|
||||
static int altera_get_note(u8 *p, s32 program_size, s32 *offset,
|
||||
char *key, char *value, int keylen, int vallen)
|
||||
/*
|
||||
* Gets key and value of NOTE fields in the JBC file.
|
||||
* Can be called in two modes: if offset pointer is NULL,
|
||||
|
|
@ -2170,7 +2170,7 @@ static int altera_get_note(u8 *p, s32 program_size,
|
|||
&p[note_table + (8 * i) + 4])];
|
||||
|
||||
if (value != NULL)
|
||||
strlcpy(value, value_ptr, length);
|
||||
strlcpy(value, value_ptr, vallen);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -2189,13 +2189,13 @@ static int altera_get_note(u8 *p, s32 program_size,
|
|||
strlcpy(key, &p[note_strings +
|
||||
get_unaligned_be32(
|
||||
&p[note_table + (8 * i)])],
|
||||
length);
|
||||
keylen);
|
||||
|
||||
if (value != NULL)
|
||||
strlcpy(value, &p[note_strings +
|
||||
get_unaligned_be32(
|
||||
&p[note_table + (8 * i) + 4])],
|
||||
length);
|
||||
vallen);
|
||||
|
||||
*offset = i + 1;
|
||||
}
|
||||
|
|
@ -2449,7 +2449,7 @@ int altera_init(struct altera_config *config, const struct firmware *fw)
|
|||
__func__, (format_version == 2) ? "Jam STAPL" :
|
||||
"pre-standardized Jam 1.1");
|
||||
while (altera_get_note((u8 *)fw->data, fw->size,
|
||||
&offset, key, value, 256) == 0)
|
||||
&offset, key, value, 32, 256) == 0)
|
||||
printk(KERN_INFO "%s: NOTE \"%s\" = \"%s\"\n",
|
||||
__func__, key, value);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -394,7 +394,7 @@ static const struct pcr_ops rts522a_pcr_ops = {
|
|||
void rts522a_init_params(struct rtsx_pcr *pcr)
|
||||
{
|
||||
rts5227_init_params(pcr);
|
||||
|
||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
|
||||
pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
|
||||
|
||||
pcr->option.ocp_en = 1;
|
||||
|
|
|
|||
|
|
@ -618,6 +618,7 @@ static const struct pcr_ops rts524a_pcr_ops = {
|
|||
void rts524a_init_params(struct rtsx_pcr *pcr)
|
||||
{
|
||||
rts5249_init_params(pcr);
|
||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
|
||||
pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
|
||||
pcr->option.ltr_l1off_snooze_sspwrgate =
|
||||
LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF;
|
||||
|
|
@ -733,6 +734,7 @@ static const struct pcr_ops rts525a_pcr_ops = {
|
|||
void rts525a_init_params(struct rtsx_pcr *pcr)
|
||||
{
|
||||
rts5249_init_params(pcr);
|
||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(25, 29, 11);
|
||||
pcr->option.ltr_l1off_sspwrgate = LTR_L1OFF_SSPWRGATE_5250_DEF;
|
||||
pcr->option.ltr_l1off_snooze_sspwrgate =
|
||||
LTR_L1OFF_SNOOZE_SSPWRGATE_5250_DEF;
|
||||
|
|
|
|||
|
|
@ -663,7 +663,7 @@ void rts5260_init_params(struct rtsx_pcr *pcr)
|
|||
pcr->sd30_drive_sel_1v8 = CFG_DRIVER_TYPE_B;
|
||||
pcr->sd30_drive_sel_3v3 = CFG_DRIVER_TYPE_B;
|
||||
pcr->aspm_en = ASPM_L1_EN;
|
||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(1, 29, 16);
|
||||
pcr->tx_initial_phase = SET_CLOCK_PHASE(27, 29, 11);
|
||||
pcr->rx_initial_phase = SET_CLOCK_PHASE(24, 6, 5);
|
||||
|
||||
pcr->ic_version = rts5260_get_ic_version(pcr);
|
||||
|
|
|
|||
|
|
@ -600,7 +600,9 @@ int hl_device_set_debug_mode(struct hl_device *hdev, bool enable)
|
|||
goto out;
|
||||
}
|
||||
|
||||
hdev->asic_funcs->halt_coresight(hdev);
|
||||
if (!hdev->hard_reset_pending)
|
||||
hdev->asic_funcs->halt_coresight(hdev);
|
||||
|
||||
hdev->in_debug = 0;
|
||||
|
||||
goto out;
|
||||
|
|
@ -1185,6 +1187,7 @@ int hl_device_init(struct hl_device *hdev, struct class *hclass)
|
|||
if (hdev->asic_funcs->get_hw_state(hdev) == HL_DEVICE_HW_STATE_DIRTY) {
|
||||
dev_info(hdev->dev,
|
||||
"H/W state is dirty, must reset before initializing\n");
|
||||
hdev->asic_funcs->halt_engines(hdev, true);
|
||||
hdev->asic_funcs->hw_fini(hdev, true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -869,6 +869,11 @@ void goya_init_dma_qmans(struct hl_device *hdev)
|
|||
*/
|
||||
static void goya_disable_external_queues(struct hl_device *hdev)
|
||||
{
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_DMA))
|
||||
return;
|
||||
|
||||
WREG32(mmDMA_QM_0_GLBL_CFG0, 0);
|
||||
WREG32(mmDMA_QM_1_GLBL_CFG0, 0);
|
||||
WREG32(mmDMA_QM_2_GLBL_CFG0, 0);
|
||||
|
|
@ -930,6 +935,11 @@ static int goya_stop_external_queues(struct hl_device *hdev)
|
|||
{
|
||||
int rc, retval = 0;
|
||||
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_DMA))
|
||||
return retval;
|
||||
|
||||
rc = goya_stop_queue(hdev,
|
||||
mmDMA_QM_0_GLBL_CFG1,
|
||||
mmDMA_QM_0_CP_STS,
|
||||
|
|
@ -1719,9 +1729,18 @@ void goya_init_tpc_qmans(struct hl_device *hdev)
|
|||
*/
|
||||
static void goya_disable_internal_queues(struct hl_device *hdev)
|
||||
{
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_MME))
|
||||
goto disable_tpc;
|
||||
|
||||
WREG32(mmMME_QM_GLBL_CFG0, 0);
|
||||
WREG32(mmMME_CMDQ_GLBL_CFG0, 0);
|
||||
|
||||
disable_tpc:
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_TPC))
|
||||
return;
|
||||
|
||||
WREG32(mmTPC0_QM_GLBL_CFG0, 0);
|
||||
WREG32(mmTPC0_CMDQ_GLBL_CFG0, 0);
|
||||
|
||||
|
|
@ -1757,8 +1776,12 @@ static void goya_disable_internal_queues(struct hl_device *hdev)
|
|||
*/
|
||||
static int goya_stop_internal_queues(struct hl_device *hdev)
|
||||
{
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
int rc, retval = 0;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_MME))
|
||||
goto stop_tpc;
|
||||
|
||||
/*
|
||||
* Each queue (QMAN) is a separate H/W logic. That means that each
|
||||
* QMAN can be stopped independently and failure to stop one does NOT
|
||||
|
|
@ -1785,6 +1808,10 @@ static int goya_stop_internal_queues(struct hl_device *hdev)
|
|||
retval = -EIO;
|
||||
}
|
||||
|
||||
stop_tpc:
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_TPC))
|
||||
return retval;
|
||||
|
||||
rc = goya_stop_queue(hdev,
|
||||
mmTPC0_QM_GLBL_CFG1,
|
||||
mmTPC0_QM_CP_STS,
|
||||
|
|
@ -1950,6 +1977,11 @@ static int goya_stop_internal_queues(struct hl_device *hdev)
|
|||
|
||||
static void goya_dma_stall(struct hl_device *hdev)
|
||||
{
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_DMA))
|
||||
return;
|
||||
|
||||
WREG32(mmDMA_QM_0_GLBL_CFG1, 1 << DMA_QM_0_GLBL_CFG1_DMA_STOP_SHIFT);
|
||||
WREG32(mmDMA_QM_1_GLBL_CFG1, 1 << DMA_QM_1_GLBL_CFG1_DMA_STOP_SHIFT);
|
||||
WREG32(mmDMA_QM_2_GLBL_CFG1, 1 << DMA_QM_2_GLBL_CFG1_DMA_STOP_SHIFT);
|
||||
|
|
@ -1959,6 +1991,11 @@ static void goya_dma_stall(struct hl_device *hdev)
|
|||
|
||||
static void goya_tpc_stall(struct hl_device *hdev)
|
||||
{
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_TPC))
|
||||
return;
|
||||
|
||||
WREG32(mmTPC0_CFG_TPC_STALL, 1 << TPC0_CFG_TPC_STALL_V_SHIFT);
|
||||
WREG32(mmTPC1_CFG_TPC_STALL, 1 << TPC1_CFG_TPC_STALL_V_SHIFT);
|
||||
WREG32(mmTPC2_CFG_TPC_STALL, 1 << TPC2_CFG_TPC_STALL_V_SHIFT);
|
||||
|
|
@ -1971,6 +2008,11 @@ static void goya_tpc_stall(struct hl_device *hdev)
|
|||
|
||||
static void goya_mme_stall(struct hl_device *hdev)
|
||||
{
|
||||
struct goya_device *goya = hdev->asic_specific;
|
||||
|
||||
if (!(goya->hw_cap_initialized & HW_CAP_MME))
|
||||
return;
|
||||
|
||||
WREG32(mmMME_STALL, 0xFFFFFFFF);
|
||||
}
|
||||
|
||||
|
|
@ -4624,8 +4666,6 @@ static int goya_memset_device_memory(struct hl_device *hdev, u64 addr, u64 size,
|
|||
|
||||
rc = goya_send_job_on_qman0(hdev, job);
|
||||
|
||||
hl_cb_put(job->patched_cb);
|
||||
|
||||
hl_debugfs_remove_job(hdev, job);
|
||||
kfree(job);
|
||||
cb->cs_cnt--;
|
||||
|
|
|
|||
178
drivers/misc/hisi_hikey_usb.c
Normal file
178
drivers/misc/hisi_hikey_usb.c
Normal file
|
|
@ -0,0 +1,178 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Support for usb functionality of Hikey series boards
|
||||
* based on Hisilicon Kirin Soc.
|
||||
*
|
||||
* Copyright (C) 2017-2018 Hilisicon Electronics Co., Ltd.
|
||||
* http://www.huawei.com
|
||||
*
|
||||
* Authors: Yu Chen <chenyu56@huawei.com>
|
||||
*/
|
||||
|
||||
#include <linux/gpio/consumer.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/mod_devicetable.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/notifier.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/property.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/usb/role.h>
|
||||
|
||||
#define DEVICE_DRIVER_NAME "hisi_hikey_usb"
|
||||
|
||||
#define HUB_VBUS_POWER_ON 1
|
||||
#define HUB_VBUS_POWER_OFF 0
|
||||
#define USB_SWITCH_TO_HUB 1
|
||||
#define USB_SWITCH_TO_TYPEC 0
|
||||
#define TYPEC_VBUS_POWER_ON 1
|
||||
#define TYPEC_VBUS_POWER_OFF 0
|
||||
|
||||
struct hisi_hikey_usb {
|
||||
struct gpio_desc *otg_switch;
|
||||
struct gpio_desc *typec_vbus;
|
||||
struct gpio_desc *hub_vbus;
|
||||
|
||||
struct usb_role_switch *hub_role_sw;
|
||||
struct usb_role_switch *dev_role_sw;
|
||||
struct notifier_block nb;
|
||||
};
|
||||
|
||||
static void hub_power_ctrl(struct hisi_hikey_usb *hisi_hikey_usb, int value)
|
||||
{
|
||||
gpiod_set_value_cansleep(hisi_hikey_usb->hub_vbus, value);
|
||||
}
|
||||
|
||||
static void usb_switch_ctrl(struct hisi_hikey_usb *hisi_hikey_usb,
|
||||
int switch_to)
|
||||
{
|
||||
gpiod_set_value_cansleep(hisi_hikey_usb->otg_switch, switch_to);
|
||||
}
|
||||
|
||||
static void usb_typec_power_ctrl(struct hisi_hikey_usb *hisi_hikey_usb,
|
||||
int value)
|
||||
{
|
||||
gpiod_set_value_cansleep(hisi_hikey_usb->typec_vbus, value);
|
||||
}
|
||||
|
||||
static int hub_usb_role_switch_set(struct device *dev, enum usb_role role)
|
||||
{
|
||||
struct hisi_hikey_usb *hisi_hikey_usb = dev_get_drvdata(dev);
|
||||
|
||||
if (!hisi_hikey_usb || !hisi_hikey_usb->dev_role_sw)
|
||||
return -EINVAL;
|
||||
|
||||
switch (role) {
|
||||
case USB_ROLE_NONE:
|
||||
usb_typec_power_ctrl(hisi_hikey_usb, TYPEC_VBUS_POWER_OFF);
|
||||
usb_switch_ctrl(hisi_hikey_usb, USB_SWITCH_TO_HUB);
|
||||
hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_ON);
|
||||
break;
|
||||
case USB_ROLE_HOST:
|
||||
hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_OFF);
|
||||
usb_switch_ctrl(hisi_hikey_usb, USB_SWITCH_TO_TYPEC);
|
||||
usb_typec_power_ctrl(hisi_hikey_usb, TYPEC_VBUS_POWER_ON);
|
||||
break;
|
||||
case USB_ROLE_DEVICE:
|
||||
hub_power_ctrl(hisi_hikey_usb, HUB_VBUS_POWER_OFF);
|
||||
usb_typec_power_ctrl(hisi_hikey_usb, TYPEC_VBUS_POWER_OFF);
|
||||
usb_switch_ctrl(hisi_hikey_usb, USB_SWITCH_TO_TYPEC);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return usb_role_switch_set_role(hisi_hikey_usb->dev_role_sw, role);
|
||||
}
|
||||
|
||||
static enum usb_role hub_usb_role_switch_get(struct device *dev)
|
||||
{
|
||||
struct hisi_hikey_usb *hisi_hikey_usb = dev_get_drvdata(dev);
|
||||
|
||||
if (!hisi_hikey_usb || !hisi_hikey_usb->dev_role_sw)
|
||||
return -EINVAL;
|
||||
|
||||
return usb_role_switch_get_role(hisi_hikey_usb->dev_role_sw);
|
||||
}
|
||||
|
||||
static int hisi_hikey_usb_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct hisi_hikey_usb *hisi_hikey_usb;
|
||||
struct usb_role_switch_desc hub_role_switch = {NULL};
|
||||
|
||||
hisi_hikey_usb = devm_kzalloc(dev, sizeof(*hisi_hikey_usb), GFP_KERNEL);
|
||||
if (!hisi_hikey_usb)
|
||||
return -ENOMEM;
|
||||
|
||||
hisi_hikey_usb->typec_vbus = devm_gpiod_get(dev, "typec-vbus",
|
||||
GPIOD_OUT_LOW);
|
||||
if (IS_ERR(hisi_hikey_usb->typec_vbus))
|
||||
return PTR_ERR(hisi_hikey_usb->typec_vbus);
|
||||
|
||||
hisi_hikey_usb->otg_switch = devm_gpiod_get(dev, "otg-switch",
|
||||
GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(hisi_hikey_usb->otg_switch))
|
||||
return PTR_ERR(hisi_hikey_usb->otg_switch);
|
||||
|
||||
/* hub-vdd33-en is optional */
|
||||
hisi_hikey_usb->hub_vbus = devm_gpiod_get_optional(dev, "hub-vdd33-en",
|
||||
GPIOD_OUT_HIGH);
|
||||
if (IS_ERR(hisi_hikey_usb->hub_vbus))
|
||||
return PTR_ERR(hisi_hikey_usb->hub_vbus);
|
||||
|
||||
hisi_hikey_usb->dev_role_sw = usb_role_switch_get(dev);
|
||||
if (!hisi_hikey_usb->dev_role_sw)
|
||||
return -EPROBE_DEFER;
|
||||
if (IS_ERR(hisi_hikey_usb->dev_role_sw))
|
||||
return PTR_ERR(hisi_hikey_usb->dev_role_sw);
|
||||
|
||||
hub_role_switch.fwnode = dev_fwnode(dev);
|
||||
hub_role_switch.set = hub_usb_role_switch_set;
|
||||
hub_role_switch.get = hub_usb_role_switch_get;
|
||||
hisi_hikey_usb->hub_role_sw = usb_role_switch_register(dev,
|
||||
&hub_role_switch);
|
||||
|
||||
if (IS_ERR(hisi_hikey_usb->hub_role_sw)) {
|
||||
usb_role_switch_put(hisi_hikey_usb->dev_role_sw);
|
||||
return PTR_ERR(hisi_hikey_usb->hub_role_sw);
|
||||
}
|
||||
|
||||
platform_set_drvdata(pdev, hisi_hikey_usb);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int hisi_hikey_usb_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct hisi_hikey_usb *hisi_hikey_usb = platform_get_drvdata(pdev);
|
||||
|
||||
if (hisi_hikey_usb->hub_role_sw)
|
||||
usb_role_switch_unregister(hisi_hikey_usb->hub_role_sw);
|
||||
|
||||
if (hisi_hikey_usb->dev_role_sw)
|
||||
usb_role_switch_put(hisi_hikey_usb->dev_role_sw);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id id_table_hisi_hikey_usb[] = {
|
||||
{.compatible = "hisilicon,gpio_hubv1"},
|
||||
{}
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, id_table_hisi_hikey_usb);
|
||||
|
||||
static struct platform_driver hisi_hikey_usb_driver = {
|
||||
.probe = hisi_hikey_usb_probe,
|
||||
.remove = hisi_hikey_usb_remove,
|
||||
.driver = {
|
||||
.name = DEVICE_DRIVER_NAME,
|
||||
.of_match_table = id_table_hisi_hikey_usb,
|
||||
},
|
||||
};
|
||||
|
||||
module_platform_driver(hisi_hikey_usb_driver);
|
||||
|
||||
MODULE_AUTHOR("Yu Chen <[email protected]>");
|
||||
MODULE_DESCRIPTION("Driver Support for USB functionality of Hikey");
|
||||
MODULE_LICENSE("GPL v2");
|
||||
|
|
@ -14,7 +14,6 @@
|
|||
*/
|
||||
|
||||
#include <linux/atomic.h>
|
||||
#include <linux/cpufreq_times.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/hashtable.h>
|
||||
#include <linux/init.h>
|
||||
|
|
@ -424,9 +423,6 @@ static ssize_t uid_remove_write(struct file *file,
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
/* Also remove uids from /proc/uid_time_in_state */
|
||||
cpufreq_task_times_remove_uids(uid_start, uid_end);
|
||||
|
||||
rt_mutex_lock(&uid_lock);
|
||||
|
||||
for (; uid_start <= uid_end; uid_start++) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue