Merge remote-tracking branch 'sm8250/lineage-20' into lineage-20

* sm8250/lineage-20:
  techpack: camera: Remove duplicate check
  techpack: audio: Add missing FM recording mixer setup
  techpack: display: drm/msm: add idle state sysfs node
  input: touchscreen: Fix error due to assumption of CONFIG_FB always being set
  qcacld-3.0: Fix OOB in wma_scan_roam.c
  page_alloc: fix invalid watermark check on a negative value
  arm64: configs: debugfs.config: Disable MSM_IDLE_STATS & PAGE_EXTENSION

 Conflicts:
	techpack/display/msm/msm_drv.c
	techpack/display/msm/msm_drv.h

Change-Id: I60873dd36144837cca7ed8400d44cb3f2f6f1506
This commit is contained in:
Michael Bestas 2023-06-07 03:57:41 +03:00
commit c392091c82
No known key found for this signature in database
GPG key ID: CC95044519BE6669
9 changed files with 193 additions and 10 deletions

View file

@ -1,2 +1,4 @@
CONFIG_MSM_IDLE_STATS=n
CONFIG_PAGE_EXTENSION=n
CONFIG_PAGE_OWNER=n
CONFIG_DEBUG_FS=n

View file

@ -43,6 +43,7 @@
#include <linux/gpio.h>
#include <linux/uaccess.h>
#include <linux/cdev.h>
#include <linux/sched/signal.h>
#include <linux/platform_device.h>
#include <linux/input/synaptics_dsx.h>
#include "synaptics_dsx_core.h"

View file

@ -4965,7 +4965,7 @@ int wma_extscan_hotlist_match_event_handler(void *handle,
return -ENOMEM;
dest_ap = &dest_hotlist->ap[0];
dest_hotlist->numOfAps = event->total_entries;
dest_hotlist->numOfAps = numap;
dest_hotlist->requestId = event->config_request_id;
if (event->first_entry_index +

View file

@ -3548,11 +3548,15 @@ static inline bool zone_watermark_fast(struct zone *z, unsigned int order,
* need to be calculated.
*/
if (!order) {
long fast_free;
long usable_free;
long reserved;
fast_free = free_pages;
fast_free -= __zone_watermark_unusable_free(z, 0, alloc_flags);
if (fast_free > mark + z->lowmem_reserve[classzone_idx])
usable_free = free_pages;
reserved = __zone_watermark_unusable_free(z, 0, alloc_flags);
/* reserved may over estimate high-atomic reserves. */
usable_free -= min(usable_free, reserved);
if (usable_free > mark + z->lowmem_reserve[classzone_idx])
return true;
}

View file

@ -17894,6 +17894,10 @@ static const struct snd_kcontrol_new mmul8_mixer_controls[] = {
MSM_BACKEND_DAI_SLIMBUS_7_TX,
MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
msm_routing_put_audio_mixer),
SOC_DOUBLE_EXT("SLIM_8_TX", SND_SOC_NOPM,
MSM_BACKEND_DAI_SLIMBUS_8_TX,
MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
msm_routing_put_audio_mixer),
SOC_DOUBLE_EXT("USB_AUDIO_TX", SND_SOC_NOPM,
MSM_BACKEND_DAI_USB_TX,
MSM_FRONTEND_DAI_MULTIMEDIA8, 1, 0, msm_routing_get_audio_mixer,
@ -26474,6 +26478,7 @@ static const struct snd_soc_dapm_route intercon[] = {
{"MultiMedia1 Mixer", "SLIM_9_TX", "SLIMBUS_9_TX"},
{"MultiMedia8 Mixer", "SLIM_6_TX", "SLIMBUS_6_TX"},
{"MultiMedia8 Mixer", "SLIM_7_TX", "SLIMBUS_7_TX"},
{"MultiMedia8 Mixer", "SLIM_8_TX", "SLIMBUS_8_TX"},
{"MultiMedia8 Mixer", "SLIM_9_TX", "SLIMBUS_9_TX"},
{"MultiMedia4 Mixer", "SLIM_0_TX", "SLIMBUS_0_TX"},
{"MultiMedia4 Mixer", "SLIM_1_TX", "SLIMBUS_1_TX"},

View file

@ -267,11 +267,6 @@ int cam_mem_get_cpu_buf(int32_t buf_handle, uintptr_t *vaddr_ptr, size_t *len)
return -EINVAL;
}
if (!atomic_read(&cam_mem_mgr_state)) {
CAM_ERR(CAM_MEM, "failed. mem_mgr not initialized");
return -EINVAL;
}
if (!buf_handle || !vaddr_ptr || !len)
return -EINVAL;

View file

@ -39,6 +39,7 @@
#include <linux/of_address.h>
#include <linux/kthread.h>
#include <linux/workqueue.h>
#include <uapi/linux/sched/types.h>
#include <drm/drm_of.h>
#include <linux/reboot.h>
@ -62,6 +63,9 @@
#define MSM_VERSION_MINOR 3
#define MSM_VERSION_PATCHLEVEL 0
#define IDLE_ENCODER_MASK_DEFAULT 1
#define IDLE_TIMEOUT_MS_DEFAULT 100
static DEFINE_MUTEX(msm_release_lock);
static void msm_fb_output_poll_changed(struct drm_device *dev)
@ -703,6 +707,160 @@ static struct msm_kms *_msm_drm_init_helper(struct msm_drm_private *priv,
return kms;
}
static ssize_t idle_encoder_mask_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct drm_device *ddev = dev_get_drvdata(device);
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
u32 encoder_mask = 0;
int rc;
unsigned long flags;
rc = kstrtouint(buf, 0, &encoder_mask);
if (rc)
return rc;
spin_lock_irqsave(&idle->lock, flags);
idle->encoder_mask = encoder_mask;
idle->active_mask &= encoder_mask;
spin_unlock_irqrestore(&idle->lock, flags);
return count;
}
static ssize_t idle_encoder_mask_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_device *ddev = dev_get_drvdata(device);
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
return snprintf(buf, PAGE_SIZE, "0x%x\n", idle->encoder_mask);
}
static ssize_t idle_timeout_ms_store(struct device *device,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct drm_device *ddev = dev_get_drvdata(device);
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
u32 timeout_ms = 0;
int rc;
unsigned long flags;
rc = kstrtouint(buf, 10, &timeout_ms);
if (rc)
return rc;
spin_lock_irqsave(&idle->lock, flags);
idle->timeout_ms = timeout_ms;
spin_unlock_irqrestore(&idle->lock, flags);
return count;
}
static ssize_t idle_timeout_ms_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_device *ddev = dev_get_drvdata(device);
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
return scnprintf(buf, PAGE_SIZE, "%d\n", idle->timeout_ms);
}
static ssize_t idle_state_show(struct device *device,
struct device_attribute *attr,
char *buf)
{
struct drm_device *ddev = dev_get_drvdata(device);
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
const char *state;
unsigned long flags;
spin_lock_irqsave(&idle->lock, flags);
if (idle->active_mask) {
state = "active";
spin_unlock_irqrestore(&idle->lock, flags);
return scnprintf(buf, PAGE_SIZE, "%s (0x%x)\n",
state, idle->active_mask);
} else if (delayed_work_pending(&idle->work))
state = "pending";
else
state = "idle";
spin_unlock_irqrestore(&idle->lock, flags);
return scnprintf(buf, PAGE_SIZE, "%s\n", state);
}
static DEVICE_ATTR_RW(idle_encoder_mask);
static DEVICE_ATTR_RW(idle_timeout_ms);
static DEVICE_ATTR_RO(idle_state);
static const struct attribute *msm_idle_attrs[] = {
&dev_attr_idle_encoder_mask.attr,
&dev_attr_idle_timeout_ms.attr,
&dev_attr_idle_state.attr,
NULL
};
static void msm_idle_work(struct work_struct *work)
{
struct delayed_work *dw = to_delayed_work(work);
struct msm_idle *idle = container_of(dw, struct msm_idle, work);
struct msm_drm_private *priv = container_of(idle,
struct msm_drm_private, idle);
if (!idle->active_mask)
sysfs_notify(&priv->dev->dev->kobj, NULL, "idle_state");
}
void msm_idle_set_state(struct drm_encoder *encoder, bool active)
{
struct drm_device *ddev = encoder->dev;
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
unsigned int mask = 1 << drm_encoder_index(encoder);
unsigned long flags;
spin_lock_irqsave(&idle->lock, flags);
if (mask & idle->encoder_mask) {
if (active)
idle->active_mask |= mask;
else
idle->active_mask &= ~mask;
if (idle->timeout_ms && !idle->active_mask)
mod_delayed_work(system_wq, &idle->work,
msecs_to_jiffies(idle->timeout_ms));
else
cancel_delayed_work(&idle->work);
}
spin_unlock_irqrestore(&idle->lock, flags);
}
static void msm_idle_init(struct drm_device *ddev)
{
struct msm_drm_private *priv = ddev->dev_private;
struct msm_idle *idle = &priv->idle;
if (sysfs_create_files(&ddev->dev->kobj, msm_idle_attrs) < 0)
pr_warn("failed to create idle state file");
idle->active_mask = 0;
idle->encoder_mask = IDLE_ENCODER_MASK_DEFAULT;
idle->timeout_ms = IDLE_TIMEOUT_MS_DEFAULT;
INIT_DELAYED_WORK(&idle->work, msm_idle_work);
spin_lock_init(&idle->lock);
}
static void msm_pdev_shutdown(struct platform_device *pdev);
static int msm_drv_shutdown_notifier_cb(struct notifier_block *nb,
unsigned long event, void *unused)
@ -770,6 +928,8 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
goto dbg_init_fail;
}
msm_idle_init(ddev);
/* Bind all our sub-components: */
ret = msm_component_bind_all(dev, ddev);
if (ret)

View file

@ -631,6 +631,15 @@ struct msm_drm_thread {
struct kthread_worker worker;
};
struct msm_idle {
u32 timeout_ms;
u32 encoder_mask;
u32 active_mask;
spinlock_t lock;
struct delayed_work work;
};
struct msm_drm_private {
struct drm_device *dev;
@ -742,6 +751,8 @@ struct msm_drm_private {
/* update the flag when msm driver receives shutdown notification */
bool shutdown_in_progress;
struct msm_idle idle;
struct notifier_block msm_drv_notifier;
};
@ -1009,6 +1020,7 @@ static inline void __exit msm_mdp_unregister(void)
}
#endif
void msm_idle_set_state(struct drm_encoder *encoder, bool active);
#ifdef CONFIG_DEBUG_FS
void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m);
void msm_gem_describe_objects(struct list_head *list, struct seq_file *m);

View file

@ -2383,6 +2383,8 @@ static int _sde_encoder_rc_kickoff(struct drm_encoder *drm_enc,
/* cancel delayed off work, if any */
_sde_encoder_rc_cancel_delayed(sde_enc, sw_event);
msm_idle_set_state(drm_enc, true);
mutex_lock(&sde_enc->rc_lock);
/* return if the resource control is already in ON state */
@ -2492,6 +2494,8 @@ static int _sde_encoder_rc_frame_done(struct drm_encoder *drm_enc,
else
idle_pc_duration = IDLE_POWERCOLLAPSE_DURATION;
msm_idle_set_state(drm_enc, false);
if (!autorefresh_enabled)
kthread_mod_delayed_work(
&disp_thread->worker,