import G96XFXXUCFTK1 OSRC

This commit is contained in:
rifek4 2020-11-25 17:18:03 +01:00 committed by xxmustafacooTR
parent bdead5b636
commit 0102be7598
No known key found for this signature in database
GPG key ID: 520B6FE385CBF5C9
9 changed files with 188 additions and 23 deletions

View file

@ -7,4 +7,4 @@
* Boeffla Wakelocks Blocker
* Gestures S2W & S2S
![Logo](https://ultimate-rom.com/Ultimate_ROM_Sign_Small.jpg)
![Logo](https://ultimate-rom.com//Ultimate_ROM_Sign_Small.jpg)

View file

@ -406,6 +406,7 @@ static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *priv,
struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
int ret = 0;
struct s5p_mfc_fmt *fmt = NULL;
mfc_debug_enter();
@ -423,11 +424,12 @@ static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *priv,
if (ret)
return ret;
ctx->dst_fmt = mfc_dec_find_format(f, MFC_FMT_RAW);
if (!ctx->dst_fmt) {
fmt = mfc_dec_find_format(f, MFC_FMT_RAW);
if (!fmt) {
mfc_err_ctx("Unsupported format for destination.\n");
return -EINVAL;
}
ctx->dst_fmt = fmt;
ctx->raw_buf.num_planes = ctx->dst_fmt->num_planes;
mfc_info_ctx("Dec output pixelformat : %s\n", ctx->dst_fmt->name);
@ -475,6 +477,7 @@ static int vidioc_s_fmt_vid_out_mplane(struct file *file, void *priv,
struct s5p_mfc_dec *dec;
int ret = 0;
struct v4l2_pix_format_mplane *pix_mp = &f->fmt.pix_mp;
struct s5p_mfc_fmt *fmt = NULL;
mfc_debug_enter();
@ -498,7 +501,14 @@ static int vidioc_s_fmt_vid_out_mplane(struct file *file, void *priv,
if (ret)
return ret;
ctx->src_fmt = mfc_dec_find_format(f, MFC_FMT_DEC);
fmt = mfc_dec_find_format(f, MFC_FMT_DEC);
if (!fmt) {
mfc_err_ctx("Unsupported format for source\n");
return -EINVAL;
}
ctx->src_fmt = fmt;
ctx->codec_mode = ctx->src_fmt->codec_mode;
mfc_info_ctx("Dec input codec(%d): %s\n",
ctx->codec_mode, ctx->src_fmt->name);
@ -722,7 +732,12 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
return -EIO;
}
if (V4L2_TYPE_IS_MULTIPLANAR(buf->type) && !buf->length) {
if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) {
mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", buf->type);
return -EINVAL;
}
if (!buf->length) {
mfc_err_ctx("multiplanar but length is zero\n");
return -EIO;
}
@ -771,6 +786,12 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
mfc_err_ctx("Call on DQBUF after unrecoverable error.\n");
return -EIO;
}
if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) {
mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", buf->type);
return -EINVAL;
}
if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
ret = vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK);
} else {

View file

@ -313,7 +313,7 @@ static int vidioc_s_fmt_vid_cap_mplane(struct file *file, void *priv,
struct s5p_mfc_dev *dev = video_drvdata(file);
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
struct s5p_mfc_enc *enc = ctx->enc_priv;
struct s5p_mfc_fmt *fmt;
struct s5p_mfc_fmt *fmt = NULL;
struct v4l2_pix_format_mplane *pix_fmt_mp = &f->fmt.pix_mp;
int ret = 0;
@ -605,13 +605,25 @@ static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
return -EIO;
}
if (V4L2_TYPE_IS_MULTIPLANAR(buf->type) && !buf->length) {
if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) {
mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", buf->type);
return -EINVAL;
}
if (!buf->length) {
mfc_err_ctx("multiplanar but length is zero\n");
return -EIO;
}
if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
for (i = 0; i < ctx->src_fmt->num_planes; i++) {
if (ctx->src_fmt->mem_planes != buf->length) {
mfc_err_ctx("number of memory container miss-match "
"between Src planes(%d) and buffer length(%d)\n",
ctx->src_fmt->mem_planes, buf->length);
return -EINVAL;
}
for (i = 0; i < ctx->src_fmt->mem_planes; i++) {
if (!buf->m.planes[i].bytesused) {
mfc_debug(2, "Src input[%d] size zero, "
"changed to buf size %d\n",
@ -650,6 +662,12 @@ static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *buf)
mfc_err_ctx("Call on DQBUF after unrecoverable error.\n");
return -EIO;
}
if (!V4L2_TYPE_IS_MULTIPLANAR(buf->type)) {
mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", buf->type);
return -EINVAL;
}
if (buf->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)
ret = vb2_dqbuf(&ctx->vq_src, buf, file->f_flags & O_NONBLOCK);
else
@ -672,6 +690,11 @@ static int vidioc_streamon(struct file *file, void *priv,
return 0;
}
if (!V4L2_TYPE_IS_MULTIPLANAR(type)) {
mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", type);
return -EINVAL;
}
if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
ret = vb2_streamon(&ctx->vq_src, type);
@ -694,7 +717,7 @@ static int vidioc_streamoff(struct file *file, void *priv,
enum v4l2_buf_type type)
{
struct s5p_mfc_ctx *ctx = fh_to_mfc_ctx(file->private_data);
int ret;
int ret = -EINVAL;
mfc_debug_enter();
@ -703,7 +726,11 @@ static int vidioc_streamoff(struct file *file, void *priv,
return 0;
}
ret = -EINVAL;
if (!V4L2_TYPE_IS_MULTIPLANAR(type)) {
mfc_err_ctx("Invalid V4L2 Buffer for driver: type(%d)\n", type);
return -EINVAL;
}
if (type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE) {
s5p_mfc_qos_reset_last_framerate(ctx);

View file

@ -710,8 +710,8 @@ static struct v4l2_queryctrl controls[] = {
.id = V4L2_CID_MPEG_VIDEO_H264_HIERARCHICAL_CODING_LAYER_QP,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Hierarchical Coding Layer QP",
.minimum = INT_MIN,
.maximum = INT_MAX,
.minimum = 0,
.maximum = ((6 << 16) | 0xFFFF), /* (index << 16) | value */
.step = 1,
.default_value = 0,
},
@ -1044,8 +1044,8 @@ static struct v4l2_queryctrl controls[] = {
.id = V4L2_CID_MPEG_MFC70_VIDEO_VP8_HIERARCHY_QP_LAYER0,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "VP8 layer0 QP value",
.minimum = INT_MIN,
.maximum = INT_MAX,
.minimum = 0,
.maximum = ((2 << 16) | 0xFFFF), /* (index << 16) | value */
.step = 1,
.default_value = 0,
},
@ -1053,8 +1053,8 @@ static struct v4l2_queryctrl controls[] = {
.id = V4L2_CID_MPEG_MFC70_VIDEO_VP8_HIERARCHY_QP_LAYER1,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "VP8 layer1 QP value",
.minimum = INT_MIN,
.maximum = INT_MAX,
.minimum = 0,
.maximum = ((2 << 16) | 0xFFFF), /* (index << 16) | value */
.step = 1,
.default_value = 0,
},
@ -1062,8 +1062,8 @@ static struct v4l2_queryctrl controls[] = {
.id = V4L2_CID_MPEG_MFC70_VIDEO_VP8_HIERARCHY_QP_LAYER2,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "VP8 layer2 QP value",
.minimum = INT_MIN,
.maximum = INT_MAX,
.minimum = 0,
.maximum = ((2 << 16) | 0xFFFF), /* (index << 16) | value */
.step = 1,
.default_value = 0,
},
@ -1161,8 +1161,8 @@ static struct v4l2_queryctrl controls[] = {
.id = V4L2_CID_MPEG_VIDEO_VP9_HIERARCHICAL_CODING_LAYER_QP,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "VP9 layer0 QP value",
.minimum = INT_MIN,
.maximum = INT_MAX,
.minimum = 0,
.maximum = ((2 << 16) | 0xFFFF), /* (index << 16) | value */
.step = 1,
.default_value = 0,
},
@ -1458,8 +1458,8 @@ static struct v4l2_queryctrl controls[] = {
.id = V4L2_CID_MPEG_VIDEO_HEVC_HIERARCHICAL_CODING_LAYER_QP,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Hierarchical Coding Layer QP",
.minimum = INT_MIN,
.maximum = INT_MAX,
.minimum = 0,
.maximum = ((6 << 16) | 0xFFFF), /* (index << 16) | value */
.step = 1,
.default_value = 0, /* need to check defualt value */
},

View file

@ -673,6 +673,11 @@ enum dwc3_link_state {
DWC3_LINK_STATE_MASK = 0x0f,
};
enum {
RELEASE = 0,
NOTIFY = 1,
};
/* TRB Length, PCM and Status */
#define DWC3_TRB_SIZE_MASK (0x00ffffff)
#define DWC3_TRB_SIZE_LENGTH(n) ((n) & DWC3_TRB_SIZE_MASK)
@ -1077,8 +1082,14 @@ struct dwc3 {
struct work_struct set_vbus_current_work;
int vbus_current; /* 100mA, 500mA, 900mA */
struct delayed_work usb_event_work;
ktime_t rst_time_before;
ktime_t rst_time_first;
int rst_err_cnt;
bool rst_err_noti;
bool event_state;
};
#define ERR_RESET_CNT 3
/* -------------------------------------------------------------------------- */
/* -------------------------------------------------------------------------- */

View file

@ -632,6 +632,50 @@ static void update_cable_status(struct otg_notify *n, unsigned long event,
}
}
void send_usb_err_uevent(int err_type, int mode)
{
struct otg_notify *o_notify = get_otg_notify();
char *envp[4];
char *type = {"TYPE=usberr"};
char *state;
char *words;
int index = 0;
if (!o_notify) {
pr_err("%s o_notify is null\n", __func__);
goto err;
}
if (mode)
state = "STATE=ADD";
else
state = "STATE=REMOVE";
envp[index++] = type;
envp[index++] = state;
switch (err_type) {
case USB_ERR_ABNORMAL_RESET:
words = "WORDS=abnormal_reset";
break;
default:
pr_err("%s invalid input\n", __func__);
goto err;
}
envp[index++] = words;
envp[index++] = NULL;
if (send_usb_notify_uevent(o_notify, envp)) {
pr_err("%s error\n", __func__);
goto err;
}
pr_info("%s: %s\n", __func__, words);
err:
return;
}
EXPORT_SYMBOL(send_usb_err_uevent);
static void otg_notify_state(struct otg_notify *n,
unsigned long event, int enable)
{
@ -1944,6 +1988,23 @@ end2:
}
EXPORT_SYMBOL(is_blocked);
int send_usb_notify_uevent(struct otg_notify *n, char *envp_ext[])
{
struct usb_notify *u_notify = (struct usb_notify *)(n->u_notify);
int ret = 0;
if (!u_notify) {
pr_err("%s u_notify is null\n", __func__);
ret = -EFAULT;
goto err;
}
ret = usb_notify_dev_uevent(&u_notify->udev, envp_ext);
err:
return ret;
}
EXPORT_SYMBOL(send_usb_notify_uevent);
#if defined(CONFIG_USB_HW_PARAM)
unsigned long long *get_hw_param(struct otg_notify *n,
enum usb_hw_param index)

View file

@ -640,6 +640,39 @@ error:
return ret;
}
int usb_notify_dev_uevent(struct usb_notify_dev *udev, char *envp_ext[])
{
int ret = 0;
if (!udev || !udev->dev) {
pr_err("%s udev or udev->dev NULL\n", __func__);
ret = -EINVAL;
goto err;
}
if (strncmp("TYPE", envp_ext[0], 4)) {
pr_err("%s error.first array must be filled TYPE\n",
__func__);
ret = -EINVAL;
goto err;
}
if (strncmp("STATE", envp_ext[1], 5)) {
pr_err("%s error.second array must be filled STATE\n",
__func__);
ret = -EINVAL;
goto err;
}
kobject_uevent_env(&udev->dev->kobj, KOBJ_CHANGE, envp_ext);
pr_info("%s\n", __func__);
err:
return ret;
}
EXPORT_SYMBOL_GPL(usb_notify_dev_uevent);
static DEVICE_ATTR(disable, 0664, disable_show, disable_store);
static DEVICE_ATTR(support, 0444, support_show, NULL);
static DEVICE_ATTR(otg_speed, 0444, otg_speed_show, NULL);

View file

@ -49,6 +49,8 @@ struct usb_notify_dev {
int whitelist_array_for_mdm[MAX_CLASS_TYPE_NUM+1];
};
extern int usb_notify_dev_uevent(struct usb_notify_dev *udev,
char *envp_ext[]);
extern int usb_notify_dev_register(struct usb_notify_dev *ndev);
extern void usb_notify_dev_unregister(struct usb_notify_dev *ndev);
extern int usb_notify_class_init(void);

View file

@ -114,6 +114,10 @@ enum otg_notify_data_role {
HNOTIFY_DFP,
};
enum usb_err_type {
USB_ERR_ABNORMAL_RESET,
};
struct otg_notify {
int vbus_detect_gpio;
int redriver_en_gpio;
@ -151,6 +155,7 @@ struct otg_booster {
#ifdef CONFIG_USB_NOTIFY_LAYER
extern const char *event_string(enum otg_notify_events event);
extern const char *status_string(enum otg_notify_event_status status);
extern void send_usb_err_uevent(int usb_certi, int mode);
extern void send_otg_notify(struct otg_notify *n,
unsigned long event, int enable);
extern struct otg_booster *find_get_booster(struct otg_notify *n);
@ -167,6 +172,8 @@ extern int set_otg_notify(struct otg_notify *n);
extern void put_otg_notify(struct otg_notify *n);
extern bool is_blocked(struct otg_notify *n, int type);
extern int usb_check_whitelist_for_mdm(struct usb_device *dev);
extern int send_usb_notify_uevent
(struct otg_notify *n, char *envp_ext[]);
#if defined(CONFIG_USB_HW_PARAM)
extern unsigned long long *get_hw_param(struct otg_notify *n,
enum usb_hw_param index);
@ -180,6 +187,7 @@ static inline const char *event_string(enum otg_notify_events event)
{return NULL; }
static inline const char *status_string(enum otg_notify_event_status status)
{return NULL; }
static inline void send_usb_err_uevent(int usb_certi, int mode) {}
static inline void send_otg_notify(struct otg_notify *n,
unsigned long event, int enable) { }
static inline struct otg_booster *find_get_booster(struct otg_notify *n)
@ -199,6 +207,8 @@ static inline void put_otg_notify(struct otg_notify *n) {}
static inline bool is_blocked(struct otg_notify *n, int type) {return false; }
static inline int usb_check_whitelist_for_mdm(struct usb_device *dev)
{return 0; }
static inline int send_usb_notify_uevent
(struct otg_notify *n, char *envp_ext[]) {return 0; }
#if defined(CONFIG_USB_HW_PARAM)
static unsigned long long *get_hw_param(struct otg_notify *n,
enum usb_hw_param index) {return NULL; }