mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-25 02:32:08 +03:00
misc: mods: remove smartdimmer support
Change-Id: I57d34222ca496e4fbdc70c9001e5efa529ee03ab Signed-off-by: Chris Dragan <kdragan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1702334 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Lael Jones <lajones@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
Laxman Dewangan
parent
3d23556af2
commit
7086ef70a9
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* mods_debugfs.c - This file is part of NVIDIA MODS kernel driver.
|
||||
*
|
||||
* Copyright (c) 2014-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2014-2018, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* NVIDIA MODS kernel driver is free software: you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License,
|
||||
@@ -294,6 +294,7 @@ static int mods_dc_border_get(void *data, u64 *val)
|
||||
{
|
||||
struct tegra_dc *dc = data;
|
||||
u32 blender_reg = DC_DISP_BLEND_BACKGROUND_COLOR;
|
||||
|
||||
if (!dc->enabled)
|
||||
*val = 0ULL;
|
||||
else
|
||||
@@ -304,6 +305,7 @@ static int mods_dc_border_set(void *data, u64 val)
|
||||
{
|
||||
struct tegra_dc *dc = data;
|
||||
u32 blender_reg = DC_DISP_BLEND_BACKGROUND_COLOR;
|
||||
|
||||
if (!dc->enabled)
|
||||
return 0;
|
||||
mutex_lock(&dc->lock);
|
||||
@@ -317,97 +319,6 @@ static int mods_dc_border_set(void *data, u64 val)
|
||||
DEFINE_SIMPLE_ATTRIBUTE(mods_dc_border_fops, mods_dc_border_get,
|
||||
mods_dc_border_set, "0x%llx\n");
|
||||
|
||||
static int mods_sd_brightness_get(void *data, u64 *val)
|
||||
{
|
||||
struct tegra_dc *dc = data;
|
||||
|
||||
if (!dc->enabled)
|
||||
*val = 0ULL;
|
||||
else {
|
||||
*val = (u64)tegra_dc_readl_exported(dc, DC_DISP_SD_BL_CONTROL);
|
||||
*val = SD_BLC_BRIGHTNESS(*val);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(mods_sd_brightness_fops, mods_sd_brightness_get,
|
||||
NULL, "%llu\n");
|
||||
|
||||
static int mods_sd_pixel_count_get(void *data, u64 *val)
|
||||
{
|
||||
struct tegra_dc *dc = data;
|
||||
|
||||
if (!dc->enabled)
|
||||
*val = 0ULL;
|
||||
else
|
||||
*val = (u64)tegra_dc_readl_exported(dc, DC_DISP_SD_PIXEL_COUNT);
|
||||
return 0;
|
||||
}
|
||||
DEFINE_SIMPLE_ATTRIBUTE(mods_sd_pixel_count_fops, mods_sd_pixel_count_get,
|
||||
NULL, "%llu\n");
|
||||
|
||||
static int mods_sd_hw_k_rgb_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct tegra_dc *dc = s->private;
|
||||
u32 val;
|
||||
|
||||
if (!dc->enabled)
|
||||
val = 0U;
|
||||
else
|
||||
val = tegra_dc_readl_exported(dc, DC_DISP_SD_HW_K_VALUES);
|
||||
|
||||
seq_printf(s, "%u %u %u\n", SD_HW_K_R(val), SD_HW_K_G(val),
|
||||
SD_HW_K_B(val));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mods_sd_hw_k_rgb_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, mods_sd_hw_k_rgb_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations mods_sd_hw_k_rgb_fops = {
|
||||
.open = mods_sd_hw_k_rgb_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
static int mods_sd_histogram_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
struct tegra_dc *dc = s->private;
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < DC_DISP_SD_HISTOGRAM_NUM; i++) {
|
||||
u32 val;
|
||||
|
||||
if (!dc->enabled)
|
||||
val = 0U;
|
||||
else
|
||||
val = tegra_dc_readl_exported(dc,
|
||||
DC_DISP_SD_HISTOGRAM(i));
|
||||
seq_printf(s, "%u %u %u %u\n",
|
||||
SD_HISTOGRAM_BIN_0(val),
|
||||
SD_HISTOGRAM_BIN_1(val),
|
||||
SD_HISTOGRAM_BIN_2(val),
|
||||
SD_HISTOGRAM_BIN_3(val));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int mods_sd_histogram_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
return single_open(file, mods_sd_histogram_show, inode->i_private);
|
||||
}
|
||||
|
||||
static const struct file_operations mods_sd_histogram_fops = {
|
||||
.open = mods_sd_histogram_open,
|
||||
.read = seq_read,
|
||||
.llseek = seq_lseek,
|
||||
.release = single_release,
|
||||
};
|
||||
|
||||
|
||||
static int mods_dc_ocp_show(struct seq_file *s, void *unused)
|
||||
{
|
||||
seq_puts(s, "rgb\n");
|
||||
@@ -626,9 +537,6 @@ int mods_create_debugfs(struct miscdevice *modsdev)
|
||||
#ifdef CONFIG_TEGRA_DC
|
||||
for (dc_idx = 0; dc_idx < nheads; dc_idx++) {
|
||||
struct dentry *dc_debugfs_dir;
|
||||
#ifdef CONFIG_TEGRA_NVSD
|
||||
struct dentry *sd_debugfs_dir;
|
||||
#endif
|
||||
char devname[16];
|
||||
struct tegra_dc *dc = tegra_dc_get_dc(dc_idx);
|
||||
|
||||
@@ -712,36 +620,6 @@ int mods_create_debugfs(struct miscdevice *modsdev)
|
||||
goto remove_out;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_TEGRA_NVSD)
|
||||
sd_debugfs_dir = debugfs_create_dir("smartdimmer",
|
||||
dc_debugfs_dir);
|
||||
|
||||
retval = debugfs_create_file("brightness", 0444,
|
||||
sd_debugfs_dir, dc, &mods_sd_brightness_fops);
|
||||
if (IS_ERR(retval)) {
|
||||
err = -EIO;
|
||||
goto remove_out;
|
||||
}
|
||||
retval = debugfs_create_file("pixel_count", 0444,
|
||||
sd_debugfs_dir, dc, &mods_sd_pixel_count_fops);
|
||||
if (IS_ERR(retval)) {
|
||||
err = -EIO;
|
||||
goto remove_out;
|
||||
}
|
||||
retval = debugfs_create_file("hw_k_rgb", 0444,
|
||||
sd_debugfs_dir, dc, &mods_sd_hw_k_rgb_fops);
|
||||
if (IS_ERR(retval)) {
|
||||
err = -EIO;
|
||||
goto remove_out;
|
||||
}
|
||||
retval = debugfs_create_file("histogram", 0444,
|
||||
sd_debugfs_dir, dc, &mods_sd_histogram_fops);
|
||||
if (IS_ERR(retval)) {
|
||||
err = -EIO;
|
||||
goto remove_out;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (dc->out && dc->out->type == TEGRA_DC_OUT_DSI) {
|
||||
struct dentry *dsi_debugfs_dir;
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ struct mods_file_private_data {
|
||||
u32 access_token;
|
||||
};
|
||||
|
||||
typedef struct mods_file_private_data *MODS_PRIV;
|
||||
#define MODS_PRIV struct mods_file_private_data *
|
||||
|
||||
/* VM private data */
|
||||
struct mods_vm_private_data {
|
||||
@@ -549,8 +549,6 @@ int esc_mods_dma_async_issue_pending(struct file *fp,
|
||||
#ifdef CONFIG_TEGRA_DC
|
||||
int esc_mods_tegra_dc_config_possible(struct file *fp,
|
||||
struct MODS_TEGRA_DC_CONFIG_POSSIBLE *p);
|
||||
int esc_mods_tegra_dc_setup_sd(struct file *fp,
|
||||
struct MODS_TEGRA_DC_SETUP_SD *p);
|
||||
#endif
|
||||
|
||||
#ifdef MODS_HAS_NET
|
||||
@@ -601,14 +599,6 @@ static inline int mods_create_debugfs(struct miscdevice *modsdev)
|
||||
static inline void mods_remove_debugfs(void) {}
|
||||
#endif /* CONFIG_DEBUG_FS */
|
||||
|
||||
#ifdef CONFIG_TEGRA_DC
|
||||
int mods_init_tegradc(void);
|
||||
void mods_exit_tegradc(void);
|
||||
#else
|
||||
static inline int mods_init_tegradc(void) { return 0; }
|
||||
static inline void mods_exit_tegradc(void) {}
|
||||
#endif
|
||||
|
||||
#if defined(MODS_TEGRA) && defined(MODS_HAS_DMABUF)
|
||||
int mods_init_dmabuf(void);
|
||||
void mods_exit_dmabuf(void);
|
||||
|
||||
@@ -216,10 +216,6 @@ static int __init mods_init_module(void)
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rc = mods_init_tegradc();
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
|
||||
rc = mods_init_dmabuf();
|
||||
if (rc < 0)
|
||||
return rc;
|
||||
@@ -243,8 +239,6 @@ static void __exit mods_exit_module(void)
|
||||
|
||||
mods_exit_dmabuf();
|
||||
|
||||
mods_exit_tegradc();
|
||||
|
||||
mods_remove_debugfs();
|
||||
|
||||
mods_cleanup_irq();
|
||||
@@ -554,7 +548,7 @@ static void mods_krnl_vma_close(struct vm_area_struct *vma)
|
||||
LOG_EXT();
|
||||
}
|
||||
|
||||
static struct vm_operations_struct mods_krnl_vm_ops = {
|
||||
static const struct vm_operations_struct mods_krnl_vm_ops = {
|
||||
.open = mods_krnl_vma_open,
|
||||
.close = mods_krnl_vma_close
|
||||
};
|
||||
@@ -1774,11 +1768,6 @@ static long mods_krnl_ioctl(struct file *fp,
|
||||
esc_mods_tegra_dc_config_possible,
|
||||
MODS_TEGRA_DC_CONFIG_POSSIBLE);
|
||||
break;
|
||||
case MODS_ESC_TEGRA_DC_SETUP_SD:
|
||||
MODS_IOCTL_NORETVAL(MODS_ESC_TEGRA_DC_SETUP_SD,
|
||||
esc_mods_tegra_dc_setup_sd,
|
||||
MODS_TEGRA_DC_SETUP_SD);
|
||||
break;
|
||||
#endif
|
||||
#ifdef MODS_HAS_NET
|
||||
case MODS_ESC_NET_FORCE_LINK:
|
||||
|
||||
@@ -19,9 +19,6 @@
|
||||
|
||||
#include <linux/uaccess.h>
|
||||
#include <../drivers/video/tegra/dc/dc_priv.h>
|
||||
#if defined(CONFIG_TEGRA_NVSD)
|
||||
#include <../drivers/video/tegra/dc/nvsd.h>
|
||||
#endif
|
||||
#include <video/tegra_dc_ext_kernel.h>
|
||||
#include <linux/platform/tegra/mc.h>
|
||||
#include "mods_internal.h"
|
||||
@@ -52,7 +49,7 @@ static void mods_tegra_dc_set_windowattr_basic(struct tegra_dc_win *win,
|
||||
win->out_h = mods_win->out_h;
|
||||
|
||||
mods_debug_printk(DEBUG_TEGRADC,
|
||||
"mods_tegra_dc_set_windowattr_basic window %u:\n"
|
||||
"set_windowattr_basic window %u:\n"
|
||||
"\tflags : 0x%08x\n"
|
||||
"\tfmt : %u\n"
|
||||
"\tinput : (%u, %u, %u, %u)\n"
|
||||
@@ -141,201 +138,3 @@ int esc_mods_tegra_dc_config_possible(struct file *fp,
|
||||
LOG_EXT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_TEGRA_NVSD
|
||||
|
||||
static struct tegra_dc_sd_settings *mods_sd_settings;
|
||||
static struct tegra_dc_sd_settings **tegra_dc_saved_sd_settings;
|
||||
|
||||
/* Cache head count retrieved during mods_init_tegradc. */
|
||||
static int cachedHeadCount;
|
||||
|
||||
#endif
|
||||
|
||||
#define SD_KINIT_BIAS(x) (((x) & 0x3) << 29)
|
||||
|
||||
int esc_mods_tegra_dc_setup_sd(struct file *fp,
|
||||
struct MODS_TEGRA_DC_SETUP_SD *args)
|
||||
{
|
||||
int i;
|
||||
struct tegra_dc *dc;
|
||||
struct tegra_dc_sd_settings *sd_settings;
|
||||
#if defined(CONFIG_ARCH_TEGRA_12x_SOC)
|
||||
u32 val;
|
||||
#endif
|
||||
u32 bw_idx;
|
||||
|
||||
if (tegra_dc_is_nvdisplay())
|
||||
return 0;
|
||||
|
||||
dc = tegra_dc_get_dc(args->head);
|
||||
sd_settings = dc->out->sd_settings;
|
||||
LOG_ENT();
|
||||
|
||||
BUG_ON(args->head > tegra_dc_get_numof_dispheads());
|
||||
|
||||
sd_settings->enable = args->enable ? 1 : 0;
|
||||
sd_settings->use_auto_pwm = false;
|
||||
sd_settings->hw_update_delay = 0;
|
||||
|
||||
sd_settings->aggressiveness = args->aggressiveness;
|
||||
sd_settings->bin_width = (1 << args->bin_width_log2);
|
||||
|
||||
sd_settings->phase_in_settings = 0;
|
||||
sd_settings->phase_in_adjustments = 0;
|
||||
sd_settings->cmd = 0;
|
||||
sd_settings->final_agg = args->aggressiveness;
|
||||
sd_settings->cur_agg_step = 0;
|
||||
sd_settings->phase_settings_step = 0;
|
||||
sd_settings->phase_adj_step = 0;
|
||||
sd_settings->num_phase_in_steps = 0;
|
||||
|
||||
sd_settings->agg_priorities.agg[0] = args->aggressiveness;
|
||||
|
||||
sd_settings->use_vid_luma = args->use_vid_luma;
|
||||
sd_settings->coeff.r = args->csc_r;
|
||||
sd_settings->coeff.g = args->csc_g;
|
||||
sd_settings->coeff.b = args->csc_b;
|
||||
|
||||
sd_settings->k_limit_enable = (args->klimit != 0);
|
||||
sd_settings->k_limit = args->klimit;
|
||||
sd_settings->sd_window_enable = true;
|
||||
|
||||
sd_settings->sd_window.h_position = args->win_x;
|
||||
sd_settings->sd_window.v_position = args->win_y;
|
||||
sd_settings->sd_window.h_size = args->win_w;
|
||||
sd_settings->sd_window.v_size = args->win_h;
|
||||
|
||||
sd_settings->soft_clipping_enable = true;
|
||||
sd_settings->soft_clipping_threshold = args->soft_clipping_threshold;
|
||||
|
||||
|
||||
sd_settings->smooth_k_enable = (args->smooth_k_inc != 0);
|
||||
sd_settings->smooth_k_incr = args->smooth_k_inc;
|
||||
|
||||
sd_settings->sd_proc_control = false;
|
||||
sd_settings->soft_clipping_correction = false;
|
||||
sd_settings->use_vpulse2 = false;
|
||||
|
||||
sd_settings->fc.time_limit = 0;
|
||||
sd_settings->fc.threshold = 0;
|
||||
|
||||
sd_settings->blp.time_constant = 1024;
|
||||
sd_settings->blp.step = 0;
|
||||
|
||||
|
||||
#ifdef CONFIG_TEGRA_SD_GEN2
|
||||
bw_idx = 0;
|
||||
#else
|
||||
bw_idx = args->bin_width_log2;
|
||||
#endif
|
||||
for (i = 0; i < MODS_TEGRA_DC_SETUP_BLTF_SIZE; i++) {
|
||||
sd_settings->bltf[bw_idx][i/4][i%4] =
|
||||
args->bltf[i];
|
||||
}
|
||||
|
||||
for (i = 0; i < MODS_TEGRA_DC_SETUP_SD_LUT_SIZE; i++) {
|
||||
sd_settings->lut[bw_idx][i].r =
|
||||
args->lut[i] & 0xff;
|
||||
sd_settings->lut[bw_idx][i].g =
|
||||
(args->lut[i] >> 8) & 0xff;
|
||||
sd_settings->lut[bw_idx][i].b =
|
||||
(args->lut[i] >> 16) & 0xff;
|
||||
}
|
||||
|
||||
#if defined(CONFIG_TEGRA_NVSD)
|
||||
nvsd_init(dc, sd_settings);
|
||||
#endif
|
||||
#if defined(CONFIG_ARCH_TEGRA_12x_SOC)
|
||||
tegra_dc_io_start(dc);
|
||||
val = tegra_dc_readl_exported(dc, DC_DISP_SD_CONTROL);
|
||||
val &= ~SD_KINIT_BIAS(0);
|
||||
val &= ~SD_CORRECTION_MODE_MAN;
|
||||
tegra_dc_writel_exported(dc, val | SD_KINIT_BIAS(args->k_init_bias),
|
||||
DC_DISP_SD_CONTROL);
|
||||
tegra_dc_io_end(dc);
|
||||
#endif
|
||||
|
||||
if (dc->enabled) {
|
||||
mutex_lock(&dc->lock);
|
||||
tegra_dc_get(dc);
|
||||
tegra_dc_writel_exported(dc, GENERAL_ACT_REQ,
|
||||
DC_CMD_STATE_CONTROL);
|
||||
tegra_dc_put(dc);
|
||||
mutex_unlock(&dc->lock);
|
||||
}
|
||||
|
||||
LOG_EXT();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int mods_init_tegradc(void)
|
||||
{
|
||||
#if defined(CONFIG_TEGRA_NVSD)
|
||||
int i, nheads;
|
||||
int ret = 0;
|
||||
|
||||
LOG_ENT();
|
||||
nheads = tegra_dc_get_numof_dispheads();
|
||||
cachedHeadCount = nheads;
|
||||
|
||||
mods_sd_settings = kcalloc(nheads, sizeof(struct tegra_dc_sd_settings),
|
||||
GFP_KERNEL);
|
||||
|
||||
tegra_dc_saved_sd_settings = kcalloc(nheads,
|
||||
sizeof(struct
|
||||
tegra_dc_sd_settings *),
|
||||
GFP_KERNEL);
|
||||
|
||||
for (i = 0; i < nheads; i++) {
|
||||
struct tegra_dc *dc = tegra_dc_get_dc(i);
|
||||
|
||||
if (!dc)
|
||||
continue;
|
||||
|
||||
mods_sd_settings[i].enable = 0;
|
||||
mods_sd_settings[i].sd_brightness = NULL;
|
||||
mods_sd_settings[i].bl_device_name = NULL;
|
||||
mods_sd_settings[i].bl_device = NULL;
|
||||
|
||||
tegra_dc_saved_sd_settings[i] = dc->out->sd_settings;
|
||||
dc->out->sd_settings = &mods_sd_settings[i];
|
||||
|
||||
if (dc->enabled)
|
||||
nvsd_init(dc, dc->out->sd_settings);
|
||||
|
||||
if (!tegra_dc_saved_sd_settings[i])
|
||||
ret = nvsd_create_sysfs(&dc->ndev->dev);
|
||||
}
|
||||
LOG_EXT();
|
||||
return ret;
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
void mods_exit_tegradc(void)
|
||||
{
|
||||
#if defined(CONFIG_TEGRA_NVSD)
|
||||
int i, nheads;
|
||||
|
||||
LOG_ENT();
|
||||
nheads = tegra_dc_get_numof_dispheads();
|
||||
|
||||
BUG_ON(nheads != cachedHeadCount);
|
||||
|
||||
for (i = 0; i < nheads; i++) {
|
||||
struct tegra_dc *dc = tegra_dc_get_dc(i);
|
||||
|
||||
if (!dc)
|
||||
continue;
|
||||
if (!tegra_dc_saved_sd_settings[i])
|
||||
nvsd_remove_sysfs(&dc->ndev->dev);
|
||||
dc->out->sd_settings = tegra_dc_saved_sd_settings[i];
|
||||
if (dc->enabled)
|
||||
nvsd_init(dc, dc->out->sd_settings);
|
||||
}
|
||||
kfree(tegra_dc_saved_sd_settings);
|
||||
kfree(mods_sd_settings);
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user