Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp467917ybl; Tue, 28 Jan 2020 06:26:12 -0800 (PST) X-Google-Smtp-Source: APXvYqxCb+EHnfsqeVzmonEvuATR7UUbHf1XvHnd905Kh936iG7yrofTzYGhM5+fMq6clGJHLfV+ X-Received: by 2002:a05:6808:643:: with SMTP id z3mr3011969oih.19.1580221572167; Tue, 28 Jan 2020 06:26:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580221572; cv=none; d=google.com; s=arc-20160816; b=EXCrAz43M6uVmL71obKVY0m3OE/QpBeROf8SdTsCJ2VeuMqWgJh2rIsdnRk5hfp3iy JUZvRHV0cBlPQwwjtcmpbBtvLWp+po0YcUp0bArTllF910RsuEe0niuBKTG7Xuz91Q5d V7aCdSb8hDnRpQHeoyUKVB/6Iqqa+SdHqNcMHOgDocYmQaHFNsZaJ0wIf/nouGY2xwPq Bt9CUtjzbGz+CHCknXztNu0tlcpC0uicLZ2kJoE3pkAzjt8MT130fVYSHG2mYTS3ZOeI 5Z6LET7CAdzeCD13EoZtecG7hBLmcLbXLxUQgC/UKDXLW+zm/4+obyj0FecpOCfJB1qA fRag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=zN6mgZo9xgx4iHFf+YLjfzdZiPcArUXY50Pkubuj4yU=; b=Njpg1LYVfVJRtwn0VsSjkfuSGeAWGV4ZRfF/FCb7dBqvZr1kJKPVgG9DpoL34NbogC VcrRTonBhDGRsQXodMdaYlj4WykQ8Ivnbh5irXeMcXeZwlxTFtQzJ1jhOcJ/TOTjCJvV SrwP2xt7F8Og1xiwGK8gZzKXjaIo/bOIu8PnsyFKaUBizTDIBdo2DLNXAVEK7rgH9NSK l0JvUS7TCev2i6InL5nODI8ao4uwDE9g7ryHfKB0jIZYUxIRjv8E6GX/QbqgoAj0L31I n8EpKWXCKybPUzdDzJrVQMzgz/Jeq1ZeZrpZNqZTcefIzOUkHGy1CLE/HYeia/rSUd5/ fjzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LBLhwrbE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 24si5075955oip.248.2020.01.28.06.26.00; Tue, 28 Jan 2020 06:26:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=LBLhwrbE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729199AbgA1OYG (ORCPT + 99 others); Tue, 28 Jan 2020 09:24:06 -0500 Received: from mail.kernel.org ([198.145.29.99]:50304 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728763AbgA1OXx (ORCPT ); Tue, 28 Jan 2020 09:23:53 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 765A924681; Tue, 28 Jan 2020 14:23:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1580221432; bh=SojwXLNIGWlsnzjXmvjvj2wPmo5nyHywew/1B1FZj4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LBLhwrbEZ80Rv7nlWrs2mJ0G0VjORcoc/X+8CkoYIQyOABmppRCDon5dCEwMLv/OT oUi7T/jPJs9SaohOpugm9+XgWbHTu9LwKRtLds8GRQpjjKatijcDNa49hJJznCP6fq g5Nm9pWoZP8Zf6/uwWjcd7CYDuKZ3bFAcj7xDRIY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Janusz Krzysztofik , Sakari Ailus , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.9 221/271] media: ov6650: Fix incorrect use of JPEG colorspace Date: Tue, 28 Jan 2020 15:06:10 +0100 Message-Id: <20200128135908.998400798@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200128135852.449088278@linuxfoundation.org> References: <20200128135852.449088278@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Janusz Krzysztofik [ Upstream commit 12500731895ef09afc5b66b86b76c0884fb9c7bf ] Since its initial submission, the driver selects V4L2_COLORSPACE_JPEG for supported formats other than V4L2_MBUS_FMT_SBGGR8_1X8. According to v4l2-compliance test program, V4L2_COLORSPACE_JPEG applies exclusively to V4L2_PIX_FMT_JPEG. Since the sensor does not support JPEG format, fix it to always select V4L2_COLORSPACE_SRGB. Fixes: 2f6e2404799a ("[media] SoC Camera: add driver for OV6650 sensor") Signed-off-by: Janusz Krzysztofik Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/i2c/soc_camera/ov6650.c | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/media/i2c/soc_camera/ov6650.c b/drivers/media/i2c/soc_camera/ov6650.c index 7a119466f9734..e9271ad9ee4c1 100644 --- a/drivers/media/i2c/soc_camera/ov6650.c +++ b/drivers/media/i2c/soc_camera/ov6650.c @@ -203,7 +203,6 @@ struct ov6650 { unsigned long pclk_max; /* from resolution and format */ struct v4l2_fract tpf; /* as requested with s_parm */ u32 code; - enum v4l2_colorspace colorspace; }; @@ -515,7 +514,7 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd, mf->width = priv->rect.width >> priv->half_scale; mf->height = priv->rect.height >> priv->half_scale; mf->code = priv->code; - mf->colorspace = priv->colorspace; + mf->colorspace = V4L2_COLORSPACE_SRGB; mf->field = V4L2_FIELD_NONE; return 0; @@ -624,11 +623,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) priv->pclk_max = 8000000; } - if (code == MEDIA_BUS_FMT_SBGGR8_1X8) - priv->colorspace = V4L2_COLORSPACE_SRGB; - else if (code != 0) - priv->colorspace = V4L2_COLORSPACE_JPEG; - if (half_scale) { dev_dbg(&client->dev, "max resolution: QCIF\n"); coma_set |= COMA_QCIF; @@ -685,7 +679,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) priv->code = code; if (!ret) { - mf->colorspace = priv->colorspace; mf->width = priv->rect.width >> half_scale; mf->height = priv->rect.height >> half_scale; } @@ -708,6 +701,7 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd, &mf->height, 2, H_CIF, 1, 0); mf->field = V4L2_FIELD_NONE; + mf->colorspace = V4L2_COLORSPACE_SRGB; switch (mf->code) { case MEDIA_BUS_FMT_Y10_1X10: @@ -717,12 +711,10 @@ static int ov6650_set_fmt(struct v4l2_subdev *sd, case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_VYUY8_2X8: case MEDIA_BUS_FMT_UYVY8_2X8: - mf->colorspace = V4L2_COLORSPACE_JPEG; break; default: mf->code = MEDIA_BUS_FMT_SBGGR8_1X8; case MEDIA_BUS_FMT_SBGGR8_1X8: - mf->colorspace = V4L2_COLORSPACE_SRGB; break; } @@ -1048,7 +1040,6 @@ static int ov6650_probe(struct i2c_client *client, priv->rect.height = H_CIF; priv->half_scale = false; priv->code = MEDIA_BUS_FMT_YUYV8_2X8; - priv->colorspace = V4L2_COLORSPACE_JPEG; ret = ov6650_video_probe(client); if (ret) -- 2.20.1