aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/omap3isp/isppreview.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/platform/omap3isp/isppreview.c')
-rw-r--r--drivers/media/platform/omap3isp/isppreview.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/drivers/media/platform/omap3isp/isppreview.c b/drivers/media/platform/omap3isp/isppreview.c
index dd9eed45d853..0571c57dbae0 100644
--- a/drivers/media/platform/omap3isp/isppreview.c
+++ b/drivers/media/platform/omap3isp/isppreview.c
@@ -1686,21 +1686,21 @@ static int preview_set_stream(struct v4l2_subdev *sd, int enable)
1686} 1686}
1687 1687
1688static struct v4l2_mbus_framefmt * 1688static struct v4l2_mbus_framefmt *
1689__preview_get_format(struct isp_prev_device *prev, struct v4l2_subdev_fh *fh, 1689__preview_get_format(struct isp_prev_device *prev, struct v4l2_subdev_pad_config *cfg,
1690 unsigned int pad, enum v4l2_subdev_format_whence which) 1690 unsigned int pad, enum v4l2_subdev_format_whence which)
1691{ 1691{
1692 if (which == V4L2_SUBDEV_FORMAT_TRY) 1692 if (which == V4L2_SUBDEV_FORMAT_TRY)
1693 return v4l2_subdev_get_try_format(fh, pad); 1693 return v4l2_subdev_get_try_format(&prev->subdev, cfg, pad);
1694 else 1694 else
1695 return &prev->formats[pad]; 1695 return &prev->formats[pad];
1696} 1696}
1697 1697
1698static struct v4l2_rect * 1698static struct v4l2_rect *
1699__preview_get_crop(struct isp_prev_device *prev, struct v4l2_subdev_fh *fh, 1699__preview_get_crop(struct isp_prev_device *prev, struct v4l2_subdev_pad_config *cfg,
1700 enum v4l2_subdev_format_whence which) 1700 enum v4l2_subdev_format_whence which)
1701{ 1701{
1702 if (which == V4L2_SUBDEV_FORMAT_TRY) 1702 if (which == V4L2_SUBDEV_FORMAT_TRY)
1703 return v4l2_subdev_get_try_crop(fh, PREV_PAD_SINK); 1703 return v4l2_subdev_get_try_crop(&prev->subdev, cfg, PREV_PAD_SINK);
1704 else 1704 else
1705 return &prev->crop; 1705 return &prev->crop;
1706} 1706}
@@ -1727,7 +1727,7 @@ static const unsigned int preview_output_fmts[] = {
1727/* 1727/*
1728 * preview_try_format - Validate a format 1728 * preview_try_format - Validate a format
1729 * @prev: ISP preview engine 1729 * @prev: ISP preview engine
1730 * @fh: V4L2 subdev file handle 1730 * @cfg: V4L2 subdev pad configuration
1731 * @pad: pad number 1731 * @pad: pad number
1732 * @fmt: format to be validated 1732 * @fmt: format to be validated
1733 * @which: try/active format selector 1733 * @which: try/active format selector
@@ -1736,7 +1736,7 @@ static const unsigned int preview_output_fmts[] = {
1736 * engine limits and the format and crop rectangles on other pads. 1736 * engine limits and the format and crop rectangles on other pads.
1737 */ 1737 */
1738static void preview_try_format(struct isp_prev_device *prev, 1738static void preview_try_format(struct isp_prev_device *prev,
1739 struct v4l2_subdev_fh *fh, unsigned int pad, 1739 struct v4l2_subdev_pad_config *cfg, unsigned int pad,
1740 struct v4l2_mbus_framefmt *fmt, 1740 struct v4l2_mbus_framefmt *fmt,
1741 enum v4l2_subdev_format_whence which) 1741 enum v4l2_subdev_format_whence which)
1742{ 1742{
@@ -1777,7 +1777,7 @@ static void preview_try_format(struct isp_prev_device *prev,
1777 1777
1778 case PREV_PAD_SOURCE: 1778 case PREV_PAD_SOURCE:
1779 pixelcode = fmt->code; 1779 pixelcode = fmt->code;
1780 *fmt = *__preview_get_format(prev, fh, PREV_PAD_SINK, which); 1780 *fmt = *__preview_get_format(prev, cfg, PREV_PAD_SINK, which);
1781 1781
1782 switch (pixelcode) { 1782 switch (pixelcode) {
1783 case MEDIA_BUS_FMT_YUYV8_1X16: 1783 case MEDIA_BUS_FMT_YUYV8_1X16:
@@ -1795,7 +1795,7 @@ static void preview_try_format(struct isp_prev_device *prev,
1795 * is not supported yet, hardcode the output size to the crop 1795 * is not supported yet, hardcode the output size to the crop
1796 * rectangle size. 1796 * rectangle size.
1797 */ 1797 */
1798 crop = __preview_get_crop(prev, fh, which); 1798 crop = __preview_get_crop(prev, cfg, which);
1799 fmt->width = crop->width; 1799 fmt->width = crop->width;
1800 fmt->height = crop->height; 1800 fmt->height = crop->height;
1801 1801
@@ -1864,12 +1864,12 @@ static void preview_try_crop(struct isp_prev_device *prev,
1864/* 1864/*
1865 * preview_enum_mbus_code - Handle pixel format enumeration 1865 * preview_enum_mbus_code - Handle pixel format enumeration
1866 * @sd : pointer to v4l2 subdev structure 1866 * @sd : pointer to v4l2 subdev structure
1867 * @fh : V4L2 subdev file handle 1867 * @cfg: V4L2 subdev pad configuration
1868 * @code : pointer to v4l2_subdev_mbus_code_enum structure 1868 * @code : pointer to v4l2_subdev_mbus_code_enum structure
1869 * return -EINVAL or zero on success 1869 * return -EINVAL or zero on success
1870 */ 1870 */
1871static int preview_enum_mbus_code(struct v4l2_subdev *sd, 1871static int preview_enum_mbus_code(struct v4l2_subdev *sd,
1872 struct v4l2_subdev_fh *fh, 1872 struct v4l2_subdev_pad_config *cfg,
1873 struct v4l2_subdev_mbus_code_enum *code) 1873 struct v4l2_subdev_mbus_code_enum *code)
1874{ 1874{
1875 switch (code->pad) { 1875 switch (code->pad) {
@@ -1893,7 +1893,7 @@ static int preview_enum_mbus_code(struct v4l2_subdev *sd,
1893} 1893}
1894 1894
1895static int preview_enum_frame_size(struct v4l2_subdev *sd, 1895static int preview_enum_frame_size(struct v4l2_subdev *sd,
1896 struct v4l2_subdev_fh *fh, 1896 struct v4l2_subdev_pad_config *cfg,
1897 struct v4l2_subdev_frame_size_enum *fse) 1897 struct v4l2_subdev_frame_size_enum *fse)
1898{ 1898{
1899 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 1899 struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
@@ -1905,7 +1905,7 @@ static int preview_enum_frame_size(struct v4l2_subdev *sd,
1905 format.code = fse->code; 1905 format.code = fse->code;
1906 format.width = 1; 1906 format.width = 1;
1907 format.height = 1; 1907 format.height = 1;
1908 preview_try_format(prev, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 1908 preview_try_format(prev, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
1909 fse->min_width = format.width; 1909 fse->min_width = format.width;
1910 fse->min_height = format.height; 1910 fse->min_height = format.height;
1911 1911
@@ -1915,7 +1915,7 @@ static int preview_enum_frame_size(struct v4l2_subdev *sd,
1915 format.code = fse->code; 1915 format.code = fse->code;
1916 format.width = -1; 1916 format.width = -1;
1917 format.height = -1; 1917 format.height = -1;
1918 preview_try_format(prev, fh, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY); 1918 preview_try_format(prev, cfg, fse->pad, &format, V4L2_SUBDEV_FORMAT_TRY);
1919 fse->max_width = format.width; 1919 fse->max_width = format.width;
1920 fse->max_height = format.height; 1920 fse->max_height = format.height;
1921 1921
@@ -1925,7 +1925,7 @@ static int preview_enum_frame_size(struct v4l2_subdev *sd,
1925/* 1925/*
1926 * preview_get_selection - Retrieve a selection rectangle on a pad 1926 * preview_get_selection - Retrieve a selection rectangle on a pad
1927 * @sd: ISP preview V4L2 subdevice 1927 * @sd: ISP preview V4L2 subdevice
1928 * @fh: V4L2 subdev file handle 1928 * @cfg: V4L2 subdev pad configuration
1929 * @sel: Selection rectangle 1929 * @sel: Selection rectangle
1930 * 1930 *
1931 * The only supported rectangles are the crop rectangles on the sink pad. 1931 * The only supported rectangles are the crop rectangles on the sink pad.
@@ -1933,7 +1933,7 @@ static int preview_enum_frame_size(struct v4l2_subdev *sd,
1933 * Return 0 on success or a negative error code otherwise. 1933 * Return 0 on success or a negative error code otherwise.
1934 */ 1934 */
1935static int preview_get_selection(struct v4l2_subdev *sd, 1935static int preview_get_selection(struct v4l2_subdev *sd,
1936 struct v4l2_subdev_fh *fh, 1936 struct v4l2_subdev_pad_config *cfg,
1937 struct v4l2_subdev_selection *sel) 1937 struct v4l2_subdev_selection *sel)
1938{ 1938{
1939 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 1939 struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
@@ -1949,13 +1949,13 @@ static int preview_get_selection(struct v4l2_subdev *sd,
1949 sel->r.width = INT_MAX; 1949 sel->r.width = INT_MAX;
1950 sel->r.height = INT_MAX; 1950 sel->r.height = INT_MAX;
1951 1951
1952 format = __preview_get_format(prev, fh, PREV_PAD_SINK, 1952 format = __preview_get_format(prev, cfg, PREV_PAD_SINK,
1953 sel->which); 1953 sel->which);
1954 preview_try_crop(prev, format, &sel->r); 1954 preview_try_crop(prev, format, &sel->r);
1955 break; 1955 break;
1956 1956
1957 case V4L2_SEL_TGT_CROP: 1957 case V4L2_SEL_TGT_CROP:
1958 sel->r = *__preview_get_crop(prev, fh, sel->which); 1958 sel->r = *__preview_get_crop(prev, cfg, sel->which);
1959 break; 1959 break;
1960 1960
1961 default: 1961 default:
@@ -1968,7 +1968,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,
1968/* 1968/*
1969 * preview_set_selection - Set a selection rectangle on a pad 1969 * preview_set_selection - Set a selection rectangle on a pad
1970 * @sd: ISP preview V4L2 subdevice 1970 * @sd: ISP preview V4L2 subdevice
1971 * @fh: V4L2 subdev file handle 1971 * @cfg: V4L2 subdev pad configuration
1972 * @sel: Selection rectangle 1972 * @sel: Selection rectangle
1973 * 1973 *
1974 * The only supported rectangle is the actual crop rectangle on the sink pad. 1974 * The only supported rectangle is the actual crop rectangle on the sink pad.
@@ -1976,7 +1976,7 @@ static int preview_get_selection(struct v4l2_subdev *sd,
1976 * Return 0 on success or a negative error code otherwise. 1976 * Return 0 on success or a negative error code otherwise.
1977 */ 1977 */
1978static int preview_set_selection(struct v4l2_subdev *sd, 1978static int preview_set_selection(struct v4l2_subdev *sd,
1979 struct v4l2_subdev_fh *fh, 1979 struct v4l2_subdev_pad_config *cfg,
1980 struct v4l2_subdev_selection *sel) 1980 struct v4l2_subdev_selection *sel)
1981{ 1981{
1982 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 1982 struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
@@ -1995,17 +1995,17 @@ static int preview_set_selection(struct v4l2_subdev *sd,
1995 * rectangle. 1995 * rectangle.
1996 */ 1996 */
1997 if (sel->flags & V4L2_SEL_FLAG_KEEP_CONFIG) { 1997 if (sel->flags & V4L2_SEL_FLAG_KEEP_CONFIG) {
1998 sel->r = *__preview_get_crop(prev, fh, sel->which); 1998 sel->r = *__preview_get_crop(prev, cfg, sel->which);
1999 return 0; 1999 return 0;
2000 } 2000 }
2001 2001
2002 format = __preview_get_format(prev, fh, PREV_PAD_SINK, sel->which); 2002 format = __preview_get_format(prev, cfg, PREV_PAD_SINK, sel->which);
2003 preview_try_crop(prev, format, &sel->r); 2003 preview_try_crop(prev, format, &sel->r);
2004 *__preview_get_crop(prev, fh, sel->which) = sel->r; 2004 *__preview_get_crop(prev, cfg, sel->which) = sel->r;
2005 2005
2006 /* Update the source format. */ 2006 /* Update the source format. */
2007 format = __preview_get_format(prev, fh, PREV_PAD_SOURCE, sel->which); 2007 format = __preview_get_format(prev, cfg, PREV_PAD_SOURCE, sel->which);
2008 preview_try_format(prev, fh, PREV_PAD_SOURCE, format, sel->which); 2008 preview_try_format(prev, cfg, PREV_PAD_SOURCE, format, sel->which);
2009 2009
2010 return 0; 2010 return 0;
2011} 2011}
@@ -2013,17 +2013,17 @@ static int preview_set_selection(struct v4l2_subdev *sd,
2013/* 2013/*
2014 * preview_get_format - Handle get format by pads subdev method 2014 * preview_get_format - Handle get format by pads subdev method
2015 * @sd : pointer to v4l2 subdev structure 2015 * @sd : pointer to v4l2 subdev structure
2016 * @fh : V4L2 subdev file handle 2016 * @cfg: V4L2 subdev pad configuration
2017 * @fmt: pointer to v4l2 subdev format structure 2017 * @fmt: pointer to v4l2 subdev format structure
2018 * return -EINVAL or zero on success 2018 * return -EINVAL or zero on success
2019 */ 2019 */
2020static int preview_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 2020static int preview_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
2021 struct v4l2_subdev_format *fmt) 2021 struct v4l2_subdev_format *fmt)
2022{ 2022{
2023 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 2023 struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
2024 struct v4l2_mbus_framefmt *format; 2024 struct v4l2_mbus_framefmt *format;
2025 2025
2026 format = __preview_get_format(prev, fh, fmt->pad, fmt->which); 2026 format = __preview_get_format(prev, cfg, fmt->pad, fmt->which);
2027 if (format == NULL) 2027 if (format == NULL)
2028 return -EINVAL; 2028 return -EINVAL;
2029 2029
@@ -2034,28 +2034,28 @@ static int preview_get_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
2034/* 2034/*
2035 * preview_set_format - Handle set format by pads subdev method 2035 * preview_set_format - Handle set format by pads subdev method
2036 * @sd : pointer to v4l2 subdev structure 2036 * @sd : pointer to v4l2 subdev structure
2037 * @fh : V4L2 subdev file handle 2037 * @cfg: V4L2 subdev pad configuration
2038 * @fmt: pointer to v4l2 subdev format structure 2038 * @fmt: pointer to v4l2 subdev format structure
2039 * return -EINVAL or zero on success 2039 * return -EINVAL or zero on success
2040 */ 2040 */
2041static int preview_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, 2041static int preview_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg,
2042 struct v4l2_subdev_format *fmt) 2042 struct v4l2_subdev_format *fmt)
2043{ 2043{
2044 struct isp_prev_device *prev = v4l2_get_subdevdata(sd); 2044 struct isp_prev_device *prev = v4l2_get_subdevdata(sd);
2045 struct v4l2_mbus_framefmt *format; 2045 struct v4l2_mbus_framefmt *format;
2046 struct v4l2_rect *crop; 2046 struct v4l2_rect *crop;
2047 2047
2048 format = __preview_get_format(prev, fh, fmt->pad, fmt->which); 2048 format = __preview_get_format(prev, cfg, fmt->pad, fmt->which);
2049 if (format == NULL) 2049 if (format == NULL)
2050 return -EINVAL; 2050 return -EINVAL;
2051 2051
2052 preview_try_format(prev, fh, fmt->pad, &fmt->format, fmt->which); 2052 preview_try_format(prev, cfg, fmt->pad, &fmt->format, fmt->which);
2053 *format = fmt->format; 2053 *format = fmt->format;
2054 2054
2055 /* Propagate the format from sink to source */ 2055 /* Propagate the format from sink to source */
2056 if (fmt->pad == PREV_PAD_SINK) { 2056 if (fmt->pad == PREV_PAD_SINK) {
2057 /* Reset the crop rectangle. */ 2057 /* Reset the crop rectangle. */
2058 crop = __preview_get_crop(prev, fh, fmt->which); 2058 crop = __preview_get_crop(prev, cfg, fmt->which);
2059 crop->left = 0; 2059 crop->left = 0;
2060 crop->top = 0; 2060 crop->top = 0;
2061 crop->width = fmt->format.width; 2061 crop->width = fmt->format.width;
@@ -2064,9 +2064,9 @@ static int preview_set_format(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
2064 preview_try_crop(prev, &fmt->format, crop); 2064 preview_try_crop(prev, &fmt->format, crop);
2065 2065
2066 /* Update the source format. */ 2066 /* Update the source format. */
2067 format = __preview_get_format(prev, fh, PREV_PAD_SOURCE, 2067 format = __preview_get_format(prev, cfg, PREV_PAD_SOURCE,
2068 fmt->which); 2068 fmt->which);
2069 preview_try_format(prev, fh, PREV_PAD_SOURCE, format, 2069 preview_try_format(prev, cfg, PREV_PAD_SOURCE, format,
2070 fmt->which); 2070 fmt->which);
2071 } 2071 }
2072 2072
@@ -2093,7 +2093,7 @@ static int preview_init_formats(struct v4l2_subdev *sd,
2093 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10; 2093 format.format.code = MEDIA_BUS_FMT_SGRBG10_1X10;
2094 format.format.width = 4096; 2094 format.format.width = 4096;
2095 format.format.height = 4096; 2095 format.format.height = 4096;
2096 preview_set_format(sd, fh, &format); 2096 preview_set_format(sd, fh ? fh->pad : NULL, &format);
2097 2097
2098 return 0; 2098 return 0;
2099} 2099}