Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 47dabb99 authored by Linux Build Service Account's avatar Linux Build Service Account
Browse files

Merge 2d8171be on remote branch

Change-Id: If4c8ecf4f39ab7b00e03a2faaa6a0d3194d77f1e
parents 82277130 2d8171be
Loading
Loading
Loading
Loading
+29 −2
Original line number Original line Diff line number Diff line
@@ -5,7 +5,9 @@


#include <linux/kthread.h>
#include <linux/kthread.h>
#include <linux/notifier.h>
#include <linux/notifier.h>
#include <linux/pagevec.h>
#include <linux/shmem_fs.h>
#include <linux/shmem_fs.h>
#include <linux/swap.h>


#include "kgsl_reclaim.h"
#include "kgsl_reclaim.h"
#include "kgsl_sharedmem.h"
#include "kgsl_sharedmem.h"
@@ -193,6 +195,12 @@ ssize_t kgsl_proc_max_reclaim_limit_show(struct device *dev,
	return scnprintf(buf, PAGE_SIZE, "%d\n", kgsl_reclaim_max_page_limit);
	return scnprintf(buf, PAGE_SIZE, "%d\n", kgsl_reclaim_max_page_limit);
}
}


static void kgsl_release_page_vec(struct pagevec *pvec)
{
	check_move_unevictable_pages(pvec->pages, pvec->nr);
	__pagevec_release(pvec);
}

static int kgsl_reclaim_callback(struct notifier_block *nb,
static int kgsl_reclaim_callback(struct notifier_block *nb,
		unsigned long pid, void *data)
		unsigned long pid, void *data)
{
{
@@ -266,20 +274,39 @@ static int kgsl_reclaim_callback(struct notifier_block *nb,


		if (!kgsl_mmu_unmap(memdesc->pagetable, memdesc)) {
		if (!kgsl_mmu_unmap(memdesc->pagetable, memdesc)) {
			int i;
			int i;
			struct pagevec pvec;


			/*
			 * Pages that are first allocated are by default added
			 * to unevictable list. To reclaim them, we first clear
			 * the AS_UNEVICTABLE flag of the shmem file address
			 * space thus check_move_unevictable_pages() places
			 * them on the evictable list.
			 *
			 * Once reclaim is done, hint that further shmem
			 * allocations will have to be on the unevictable list.
			 */
			mapping_clear_unevictable(
					memdesc->shmem_filp->f_mapping);
			pagevec_init(&pvec);
			for (i = 0; i < memdesc->page_count; i++) {
			for (i = 0; i < memdesc->page_count; i++) {
				set_page_dirty_lock(memdesc->pages[i]);
				set_page_dirty_lock(memdesc->pages[i]);
				spin_lock(&memdesc->lock);
				spin_lock(&memdesc->lock);
				put_page(memdesc->pages[i]);
				pagevec_add(&pvec, memdesc->pages[i]);
				memdesc->pages[i] = NULL;
				memdesc->pages[i] = NULL;
				spin_unlock(&memdesc->lock);
				spin_unlock(&memdesc->lock);
				if (pagevec_count(&pvec) == PAGEVEC_SIZE)
					kgsl_release_page_vec(&pvec);
			}
			}
			if (pagevec_count(&pvec))
				kgsl_release_page_vec(&pvec);


			memdesc->priv |= KGSL_MEMDESC_RECLAIMED;
			memdesc->priv |= KGSL_MEMDESC_RECLAIMED;


			ret = reclaim_address_space
			ret = reclaim_address_space
				(memdesc->shmem_filp->f_mapping, data);
				(memdesc->shmem_filp->f_mapping, data);


			mapping_set_unevictable(memdesc->shmem_filp->f_mapping);
			memdesc->reclaimed_page_count += memdesc->page_count;
			memdesc->reclaimed_page_count += memdesc->page_count;
			atomic_add(memdesc->page_count,
			atomic_add(memdesc->page_count,
					&process->reclaimed_page_count);
					&process->reclaimed_page_count);
+2 −0
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/*
/*
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
 * Copyright (c) 2002,2007-2021, The Linux Foundation. All rights reserved.
 */
 */


@@ -974,6 +975,7 @@ static int kgsl_memdesc_file_setup(struct kgsl_memdesc *memdesc, uint64_t size)
			memdesc->shmem_filp = NULL;
			memdesc->shmem_filp = NULL;
			return ret;
			return ret;
		}
		}
		mapping_set_unevictable(memdesc->shmem_filp->f_mapping);
	}
	}


	return 0;
	return 0;
+4 −0
Original line number Original line Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2014-2015, 2017-2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2014-2015, 2017-2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. */


#include <linux/kernel.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/module.h>
@@ -143,8 +144,11 @@ static int pmic_spmi_probe(struct spmi_device *sdev)


MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);
MODULE_DEVICE_TABLE(of, pmic_spmi_id_table);


static void pmic_spmi_remove(struct spmi_device *sdev) {}

static struct spmi_driver pmic_spmi_driver = {
static struct spmi_driver pmic_spmi_driver = {
	.probe = pmic_spmi_probe,
	.probe = pmic_spmi_probe,
	.remove = pmic_spmi_remove,
	.driver = {
	.driver = {
		.name = "pmic-spmi",
		.name = "pmic-spmi",
		.of_match_table = pmic_spmi_id_table,
		.of_match_table = pmic_spmi_id_table,
+91 −3
Original line number Original line Diff line number Diff line
@@ -6,7 +6,7 @@
 * it under the terms of the GNU General Public License version 2 as
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * published by the Free Software Foundation.
 *
 *
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */
 */
 
 
#include "aphost.h"
#include "aphost.h"
@@ -242,17 +242,36 @@ static ssize_t jsrequest_store(struct device *dev,
	request_t request;
	request_t request;
	int vibState = 0;
	int vibState = 0;
	int err = 0;
	int err = 0;

#ifdef COMPATIBLE_NOT_SUPPORT_DFU
	unsigned int getNorVersion = 0;
#endif
	if (gspi_client == NULL) {
	if (gspi_client == NULL) {
		pr_err("invalid gspi_client\n");
		pr_err("invalid gspi_client\n");
		return size;
		return size;
	}
	}


#ifdef COMPATIBLE_NOT_SUPPORT_DFU
	getNorVersion = (unsigned int)
		atomic_read(&gspi_client->probeGetNordicVersion);
	if (getNorVersion <= 0x81000101 && getNorVersion > 0) {
		pr_debug("%s DFU not supported version number:%d.%d\n",
			__func__, (getNorVersion >> 8) & 0xff,
			getNorVersion & 0xff);
	} else {
		pinctrl_select_state(
		pinctrl_select_state(
			gspi_client->pinctrl_info.pinctrl,
			gspi_client->pinctrl_info.pinctrl,
			gspi_client->pinctrl_info.suspend);
			gspi_client->pinctrl_info.suspend);
		gspi_client->js_ledl_state = 1;
		gspi_client->js_ledl_state = 1;

		pr_debug("%s DFU supported version number:%d.%d\n",
			__func__, (getNorVersion >> 8) & 0xff,
			getNorVersion & 0xff);
	}
#else
	pinctrl_select_state(
		gspi_client->pinctrl_info.pinctrl,
		gspi_client->pinctrl_info.suspend);
	gspi_client->js_ledl_state = 1;
#endif
	mutex_lock(&gspi_client->js_mutex);
	mutex_lock(&gspi_client->js_mutex);
	err = kstrtouint(buf, 16, &input);
	err = kstrtouint(buf, 16, &input);
	if (err) {
	if (err) {
@@ -529,6 +548,18 @@ static int js_thread(void *data)
				| spi_client->rxbuffer[1]);
				| spi_client->rxbuffer[1]);
				atomic_set(&spi_client->nordicAcknowledge,
				atomic_set(&spi_client->nordicAcknowledge,
							 input);
							 input);
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
			if ((unsigned int)
				atomic_read(
				&gspi_client->probeGetNordicVersionFlag)) {
				atomic_set(
					&spi_client->probeGetNordicVersion,
					input);
				atomic_set(
					&spi_client->probeGetNordicVersionFlag,
					0);
			}
#endif
			}
			}
			memset(&lastRequest, 0, sizeof(lastRequest));
			memset(&lastRequest, 0, sizeof(lastRequest));
		}
		}
@@ -742,6 +773,59 @@ static int js_io_init(struct js_spi_client *spi_client)
	return ret;
	return ret;
}
}


#ifdef COMPATIBLE_NOT_SUPPORT_DFU
static int probe_get_nordic_version(void)
{
	unsigned int getNorVersion = 0;

	atomic_set(&gspi_client->probeGetNordicVersionFlag, 1);
	atomic_set(&gspi_client->userRequest, 0x81000000);
	atomic_inc(&gspi_client->dataflag);
	wake_up_interruptible(&gspi_client->wait_queue);
	pinctrl_select_state(
		gspi_client->pinctrl_info.pinctrl,
		gspi_client->pinctrl_info.suspend);
	gspi_client->js_ledl_state = 1;
	while (1) {
		if (!((unsigned int)
			atomic_read(&gspi_client->probeGetNordicVersionFlag))) {
			pr_debug("nordic version flag %d userRequest 0x%x\n",
			(unsigned int)atomic_read(
				&gspi_client->probeGetNordicVersionFlag),
			(unsigned int)atomic_read(
				&gspi_client->userRequest));
			getNorVersion = (unsigned int)atomic_read(
				&gspi_client->probeGetNordicVersion);
			pr_debug("nordic version %d.%d getNorVersion 0x%x\n",
				(getNorVersion >> 8) & 0xff,
				getNorVersion & 0xff, getNorVersion);
			pinctrl_select_state(
				gspi_client->pinctrl_info.pinctrl,
				gspi_client->pinctrl_info.suspend);
			gspi_client->js_ledl_state = 0;
		} else {
			atomic_set(&gspi_client->probeGetNordicVersionFlag, 1);
			atomic_set(&gspi_client->userRequest, 0x81000000);
			atomic_inc(&gspi_client->dataflag);
			wake_up_interruptible(&gspi_client->wait_queue);
			pinctrl_select_state(
				gspi_client->pinctrl_info.pinctrl,
				gspi_client->pinctrl_info.suspend);
			gspi_client->js_ledl_state = 1;

			pr_err("Failed to get version flag %d userRequest 0x%x\n",
			(unsigned int)atomic_read(
				&gspi_client->probeGetNordicVersionFlag),
			(unsigned int)atomic_read(
				&gspi_client->userRequest));

		}
		break;
	}

	return 0;
}
#endif
static int js_spi_setup(struct spi_device *spi)
static int js_spi_setup(struct spi_device *spi)
{
{
	struct js_spi_client   *spi_client;
	struct js_spi_client   *spi_client;
@@ -805,6 +889,10 @@ static int js_spi_setup(struct spi_device *spi)


	js_io_init(spi_client);
	js_io_init(spi_client);
	js_set_power(1);
	js_set_power(1);
#ifdef COMPATIBLE_NOT_SUPPORT_DFU
	msleep(5000);
	probe_get_nordic_version();
#endif
	return rc;
	return rc;


spi_free:
spi_free:
+9 −2
Original line number Original line Diff line number Diff line
@@ -6,7 +6,7 @@
 * it under the terms of the GNU General Public License version 2 as
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 * published by the Free Software Foundation.
 *
 *
 * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
 * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved.
 */
 */


#ifndef __APHOST_H__
#ifndef __APHOST_H__
@@ -70,12 +70,13 @@
#include <linux/string.h>
#include <linux/string.h>
#include <linux/time.h>
#include <linux/time.h>
#include <linux/timer.h>
#include <linux/timer.h>

#include <linux/delay.h>
#include <uapi/linux/sched/types.h>
#include <uapi/linux/sched/types.h>


#define MAX_PACK_SIZE 100 
#define MAX_PACK_SIZE 100 
#define MAX_DATA_SIZE 32
#define MAX_DATA_SIZE 32
//#define MANUL_CONTROL_JOYSTICK_RLED
//#define MANUL_CONTROL_JOYSTICK_RLED
#define COMPATIBLE_NOT_SUPPORT_DFU


#define XFR_SIZE  190
#define XFR_SIZE  190
/* Protocol commands to interact with firmware */
/* Protocol commands to interact with firmware */
@@ -154,6 +155,12 @@ struct js_spi_client {
	atomic_t dataflag;
	atomic_t dataflag;
	atomic_t userRequest; /* request from userspace */
	atomic_t userRequest; /* request from userspace */
	atomic_t nordicAcknowledge; /* ack from nordic52832 master */
	atomic_t nordicAcknowledge; /* ack from nordic52832 master */

#ifdef COMPATIBLE_NOT_SUPPORT_DFU
	atomic_t probeGetNordicVersion; /* ack from nordic52832 master */
	atomic_t probeGetNordicVersionFlag;
#endif

	unsigned char JoyStickBondState; /* 1:left JoyStick 2:right JoyStick */
	unsigned char JoyStickBondState; /* 1:left JoyStick 2:right JoyStick */
	bool suspend;
	bool suspend;
	wait_queue_head_t  wait_queue;
	wait_queue_head_t  wait_queue;
Loading