summaryrefslogtreecommitdiffstats
path: root/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2020-08-07 13:00:53 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2020-08-07 13:00:53 -0700
commitfa73e212318a3277ae1f304febbc617c75d4d2db (patch)
tree54fea325ba419be2388cb9515e778f5c0d9a2f8c /drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
parent75dee3b6de4ce31464ffb827b81ddb5414599159 (diff)
parentf45882cfb152f5d3a421fd58f177f227e44843b9 (diff)
downloadlinux-fa73e212318a3277ae1f304febbc617c75d4d2db.tar.bz2
Merge tag 'media/v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
Pull media updates from Mauro Carvalho Chehab: - Legacy soc_camera driver was removed from staging - New I2C sensor related drivers: dw9768, ch7322, max9271, rdacm20 - TI vpe driver code was re-organized and had new features added - Added Xilinx MIPI CSI-2 Rx Subsystem driver - Added support for Infrared Toy and IR Droid devices - Lots of random driver fixes, new features and cleanups * tag 'media/v5.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media: (318 commits) media: camss: fix memory leaks on error handling paths in probe media: davinci: vpif_capture: fix potential double free media: radio: remove redundant assignment to variable retval media: allegro: fix potential null dereference on header media: mtk-mdp: Fix a refcounting bug on error in init media: allegro: fix an error pointer vs NULL check media: meye: fix missing pm_mchip_mode field media: cafe-driver: use generic power management media: saa7164: use generic power management media: v4l2-dev/ioctl: Fix document for VIDIOC_QUERYCAP media: v4l2: Correct kernel-doc inconsistency media: v4l2: Correct kernel-doc inconsistency media: dvbdev.h: keep * together with the type media: v4l2-subdev.h: keep * together with the type media: videobuf2: Print videobuf2 buffer state by name media: colorspaces-details.rst: fix V4L2_COLORSPACE_JPEG description media: tw68: use generic power management media: meye: use generic power management media: cx88: use generic power management media: cx25821: use generic power management ...
Diffstat (limited to 'drivers/media/common/v4l2-tpg/v4l2-tpg-core.c')
-rw-r--r--drivers/media/common/v4l2-tpg/v4l2-tpg-core.c40
1 files changed, 33 insertions, 7 deletions
diff --git a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
index 50f1e0b28b25..630a75e0eeb1 100644
--- a/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
+++ b/drivers/media/common/v4l2-tpg/v4l2-tpg-core.c
@@ -1927,44 +1927,46 @@ typedef struct { u16 __; u8 _; } __packed x24;
static noinline void tpg_print_str_2(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
unsigned p, unsigned first, unsigned div, unsigned step,
- int y, int x, char *text, unsigned len)
+ int y, int x, const char *text, unsigned len)
{
PRINTSTR(u8);
}
static noinline void tpg_print_str_4(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
unsigned p, unsigned first, unsigned div, unsigned step,
- int y, int x, char *text, unsigned len)
+ int y, int x, const char *text, unsigned len)
{
PRINTSTR(u16);
}
static noinline void tpg_print_str_6(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
unsigned p, unsigned first, unsigned div, unsigned step,
- int y, int x, char *text, unsigned len)
+ int y, int x, const char *text, unsigned len)
{
PRINTSTR(x24);
}
static noinline void tpg_print_str_8(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
unsigned p, unsigned first, unsigned div, unsigned step,
- int y, int x, char *text, unsigned len)
+ int y, int x, const char *text, unsigned len)
{
PRINTSTR(u32);
}
void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
- int y, int x, char *text)
+ int y, int x, const char *text)
{
unsigned step = V4L2_FIELD_HAS_T_OR_B(tpg->field) ? 2 : 1;
unsigned div = step;
unsigned first = 0;
- unsigned len = strlen(text);
+ unsigned len;
unsigned p;
- if (font8x16 == NULL || basep == NULL)
+ if (font8x16 == NULL || basep == NULL || text == NULL)
return;
+ len = strlen(text);
+
/* Checks if it is possible to show string */
if (y + 16 >= tpg->compose.height || x + 8 >= tpg->compose.width)
return;
@@ -2006,6 +2008,30 @@ void tpg_gen_text(const struct tpg_data *tpg, u8 *basep[TPG_MAX_PLANES][2],
}
EXPORT_SYMBOL_GPL(tpg_gen_text);
+const char *tpg_g_color_order(const struct tpg_data *tpg)
+{
+ switch (tpg->pattern) {
+ case TPG_PAT_75_COLORBAR:
+ case TPG_PAT_100_COLORBAR:
+ case TPG_PAT_CSC_COLORBAR:
+ case TPG_PAT_100_HCOLORBAR:
+ return "White, yellow, cyan, green, magenta, red, blue, black";
+ case TPG_PAT_BLACK:
+ return "Black";
+ case TPG_PAT_WHITE:
+ return "White";
+ case TPG_PAT_RED:
+ return "Red";
+ case TPG_PAT_GREEN:
+ return "Green";
+ case TPG_PAT_BLUE:
+ return "Blue";
+ default:
+ return NULL;
+ }
+}
+EXPORT_SYMBOL_GPL(tpg_g_color_order);
+
void tpg_update_mv_step(struct tpg_data *tpg)
{
int factor = tpg->mv_hor_mode > TPG_MOVE_NONE ? -1 : 1;