From f07e572f6447465d8938679533d604e402b0f066 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= Date: Thu, 18 Feb 2021 18:04:33 +0100 Subject: bcm27xx: import latest patches from the RPi foundation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit bcm2708: boot tested on RPi B+ v1.2 bcm2709: boot tested on RPi 3B v1.2 and RPi 4B v1.1 4G bcm2710: boot tested on RPi 3B v1.2 bcm2711: boot tested on RPi 4B v1.1 4G Signed-off-by: Álvaro Fernández Rojas --- ...4_services-isp-Make-all-references-to-bcm.patch | 148 +++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 target/linux/bcm27xx/patches-5.4/950-0695-staging-vc04_services-isp-Make-all-references-to-bcm.patch (limited to 'target/linux/bcm27xx/patches-5.4/950-0695-staging-vc04_services-isp-Make-all-references-to-bcm.patch') diff --git a/target/linux/bcm27xx/patches-5.4/950-0695-staging-vc04_services-isp-Make-all-references-to-bcm.patch b/target/linux/bcm27xx/patches-5.4/950-0695-staging-vc04_services-isp-Make-all-references-to-bcm.patch new file mode 100644 index 0000000000..97ca47bcd0 --- /dev/null +++ b/target/linux/bcm27xx/patches-5.4/950-0695-staging-vc04_services-isp-Make-all-references-to-bcm.patch @@ -0,0 +1,148 @@ +From 9ecf10bfe3e501b10cc72d710a70150640a0b266 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson +Date: Fri, 1 May 2020 16:54:20 +0100 +Subject: [PATCH] staging: vc04_services: isp: Make all references to + bcm2835_isp_fmt const + +The array of potential formats and their configuration should be const. +Rework all accesses so that this is possible. + +The list of supported formats was taking a copy of entries from this table. +This is unnecessary, therefore allocate an array of pointers instead of +an array of entries. + +Signed-off-by: Dave Stevenson +--- + .../bcm2835-isp/bcm2835-v4l2-isp.c | 34 ++++++++++--------- + .../bcm2835-isp/bcm2835_isp_fmts.h | 2 +- + 2 files changed, 19 insertions(+), 17 deletions(-) + +--- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c ++++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835-v4l2-isp.c +@@ -67,7 +67,7 @@ struct bcm2835_isp_q_data { + unsigned int width; + unsigned int height; + unsigned int sizeimage; +- struct bcm2835_isp_fmt *fmt; ++ const struct bcm2835_isp_fmt *fmt; + }; + + /* +@@ -232,11 +232,11 @@ struct bcm2835_isp_fmt *find_format_by_f + struct bcm2835_isp_node *node) + { + struct bcm2835_isp_fmt_list *fmts = &node->supported_fmts; +- struct bcm2835_isp_fmt *fmt; ++ const struct bcm2835_isp_fmt *fmt; + unsigned int i; + + for (i = 0; i < fmts->num_entries; i++) { +- fmt = &fmts->list[i]; ++ fmt = fmts->list[i]; + if (fmt->fourcc == fourcc) + return fmt; + } +@@ -244,8 +244,9 @@ struct bcm2835_isp_fmt *find_format_by_f + return NULL; + } + +-static struct bcm2835_isp_fmt *find_format(struct v4l2_format *f, +- struct bcm2835_isp_node *node) ++static const ++struct bcm2835_isp_fmt *find_format(struct v4l2_format *f, ++ struct bcm2835_isp_node *node) + { + return find_format_by_fourcc(node_is_stats(node) ? + f->fmt.meta.dataformat : +@@ -666,19 +667,20 @@ static const struct vb2_ops bcm2835_isp_ + .stop_streaming = bcm2835_isp_node_stop_streaming, + }; + +-static struct bcm2835_isp_fmt *get_default_format(struct bcm2835_isp_node *node) ++static const ++struct bcm2835_isp_fmt *get_default_format(struct bcm2835_isp_node *node) + { +- return &node->supported_fmts.list[0]; ++ return node->supported_fmts.list[0]; + } + + static inline unsigned int get_bytesperline(int width, +- struct bcm2835_isp_fmt *fmt) ++ const struct bcm2835_isp_fmt *fmt) + { + return ALIGN((width * fmt->depth) >> 3, fmt->bytesperline_align); + } + + static inline unsigned int get_sizeimage(int bpl, int width, int height, +- struct bcm2835_isp_fmt *fmt) ++ const struct bcm2835_isp_fmt *fmt) + { + return (bpl * height * fmt->size_multiplier_x2) >> 1; + } +@@ -892,8 +894,8 @@ static int bcm2835_isp_node_enum_fmt(str + + if (f->index < fmts->num_entries) { + /* Format found */ +- f->pixelformat = fmts->list[f->index].fourcc; +- f->flags = fmts->list[f->index].flags; ++ f->pixelformat = fmts->list[f->index]->fourcc; ++ f->flags = fmts->list[f->index]->flags; + return 0; + } + +@@ -905,7 +907,7 @@ static int bcm2835_isp_enum_framesizes(s + { + struct bcm2835_isp_node *node = video_drvdata(file); + struct bcm2835_isp_dev *dev = node_get_dev(node); +- struct bcm2835_isp_fmt *fmt; ++ const struct bcm2835_isp_fmt *fmt; + + if (node_is_stats(node) || fsize->index) + return -EINVAL; +@@ -933,7 +935,7 @@ static int bcm2835_isp_node_try_fmt(stru + struct v4l2_format *f) + { + struct bcm2835_isp_node *node = video_drvdata(file); +- struct bcm2835_isp_fmt *fmt; ++ const struct bcm2835_isp_fmt *fmt; + + if (f->type != node->queue.type) + return -EINVAL; +@@ -1113,7 +1115,7 @@ static const struct v4l2_ioctl_ops bcm28 + static int bcm2835_isp_get_supported_fmts(struct bcm2835_isp_node *node) + { + struct bcm2835_isp_dev *dev = node_get_dev(node); +- struct bcm2835_isp_fmt *list; ++ struct bcm2835_isp_fmt const **list; + unsigned int i, j, num_encodings; + u32 fourccs[MAX_SUPPORTED_ENCODINGS]; + u32 param_size = sizeof(fourccs); +@@ -1144,7 +1146,7 @@ static int bcm2835_isp_get_supported_fmt + * Any that aren't supported will waste a very small amount of memory. + */ + list = devm_kzalloc(dev->dev, +- sizeof(struct bcm2835_isp_fmt) * num_encodings, ++ sizeof(struct bcm2835_isp_fmt *) * num_encodings, + GFP_KERNEL); + if (!list) + return -ENOMEM; +@@ -1154,7 +1156,7 @@ static int bcm2835_isp_get_supported_fmt + const struct bcm2835_isp_fmt *fmt = get_fmt(fourccs[i]); + + if (fmt) { +- list[j] = *fmt; ++ list[j] = fmt; + j++; + } + } +--- a/drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_fmts.h ++++ b/drivers/staging/vc04_services/bcm2835-isp/bcm2835_isp_fmts.h +@@ -26,7 +26,7 @@ struct bcm2835_isp_fmt { + }; + + struct bcm2835_isp_fmt_list { +- struct bcm2835_isp_fmt *list; ++ struct bcm2835_isp_fmt const **list; + unsigned int num_entries; + }; + -- cgit v1.2.3