Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2952994imu; Mon, 19 Nov 2018 08:32:56 -0800 (PST) X-Google-Smtp-Source: AJdET5csoV5Y7liFvCYa+gDmVUg3QwDtuTs7TuK+RIN9cnpZ+RR4+Dw8sjeOmovBYilD0ZwS87V9 X-Received: by 2002:a17:902:e101:: with SMTP id cc1-v6mr23487192plb.165.1542645176600; Mon, 19 Nov 2018 08:32:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542645176; cv=none; d=google.com; s=arc-20160816; b=PlLVX1t6OEcgIuk+BFuza9ikgqKKm7B+O02vA5gVyrqlDecvlA9CzacDF71/X8nuwL B6Q0zWFqMcFWmaFGFZFrh0JrLD1eqK0iE89aMW7FT/G5aPW6447u7LjsVi7M2UO2+OOH 7n8EJ+t3UO52w/zfKrb2eCXdqG5mmRIW0OPQPkx+YJyc+X9lMLf8YUa5LIsnYg17DMZ2 8AlSwcErJLmPHsQSw71gvH5GXetWj8L9khK24M+lW9owLD79sNn88ia+q3ds44zLFjJJ CHvjLMP1ari8ra6hztH7Rv4x/mtfNTXaFK3LNnQAwHZr/TiRBSDDspGMZX8zStbocc/u +UDA== 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=/Qa/W5egQ8d52M6BYxPjSl8VLlhzkKEYAgqZaIrK6U0=; b=hJy3dL2XlHCJioISs743p+hCoLOeHzcThrX/gEItu/1Ps06FXWlYTBGcn0qtdIDHeE fb6V6Of1FWsx411TgkTh4yunnnl7YtKUhSYtSla3C18hCMEf4GL8LD8EvcMSbJ2QhYVV RyxzY7srOqdujyQxzOxRN/6l0+UKCMsEEitV4OcpKC1afjQyi+YdkN5CI+4me8tab6z5 /sQJ+OtT2VNlRbGleIrN9+E3tD/2PUDwcbrwp1owyfvo0UZnxOy/LHg0ihGcq7hmoavy tZVNCokMs5zqIfOux8D56KUXczZYTyqa+zcmbkU9/O0qMFnAbqR0c6PjgMfIng9MHYk7 URYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=CrLS0Tpk; 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 x3si30971727pgj.493.2018.11.19.08.32.40; Mon, 19 Nov 2018 08:32:56 -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=CrLS0Tpk; 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 S1730436AbeKTCzg (ORCPT + 99 others); Mon, 19 Nov 2018 21:55:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:53356 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730385AbeKTCzf (ORCPT ); Mon, 19 Nov 2018 21:55:35 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 F251E208E3; Mon, 19 Nov 2018 16:31:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1542645088; bh=SDbYJtXTbo2BWQEcjbt127G8QbQkmIVSme+mvdOoqw4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CrLS0Tpk4UO6zL5ih0fvFLAZXuaf7ooVkvIdV3FXYGom55DTGUBHIqASXxGwQNRXa ue0aDSdjT0dnNMuyPenfXk40KS4668xlNFo14NhDSaKGMX7Yfj/1WqxiYI41e0H7Xu hQvtgODuSnxDR9QjBSBdyTwtCKbRAJ2V0t+udUo4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Marco Felsch , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 032/205] media: tvp5150: fix width alignment during set_selection() Date: Mon, 19 Nov 2018 17:25:39 +0100 Message-Id: <20181119162623.238753941@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181119162616.586062722@linuxfoundation.org> References: <20181119162616.586062722@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marco Felsch [ Upstream commit bd24db04101f45a9c1d874fe21b0c7eab7bcadec ] The driver ignored the width alignment which exists due to the UYVY colorspace format. Fix the width alignment and make use of the the provided v4l2 helper function to set the width, height and all alignments in one. Fixes: 963ddc63e20d ("[media] media: tvp5150: Add cropping support") Signed-off-by: Marco Felsch Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/tvp5150.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) --- a/drivers/media/i2c/tvp5150.c +++ b/drivers/media/i2c/tvp5150.c @@ -901,9 +901,6 @@ static int tvp5150_set_selection(struct /* tvp5150 has some special limits */ rect.left = clamp(rect.left, 0, TVP5150_MAX_CROP_LEFT); - rect.width = clamp_t(unsigned int, rect.width, - TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, - TVP5150_H_MAX - rect.left); rect.top = clamp(rect.top, 0, TVP5150_MAX_CROP_TOP); /* Calculate height based on current standard */ @@ -917,9 +914,16 @@ static int tvp5150_set_selection(struct else hmax = TVP5150_V_MAX_OTHERS; - rect.height = clamp_t(unsigned int, rect.height, + /* + * alignments: + * - width = 2 due to UYVY colorspace + * - height, image = no special alignment + */ + v4l_bound_align_image(&rect.width, + TVP5150_H_MAX - TVP5150_MAX_CROP_LEFT - rect.left, + TVP5150_H_MAX - rect.left, 1, &rect.height, hmax - TVP5150_MAX_CROP_TOP - rect.top, - hmax - rect.top); + hmax - rect.top, 0, 0); tvp5150_write(sd, TVP5150_VERT_BLANKING_START, rect.top); tvp5150_write(sd, TVP5150_VERT_BLANKING_STOP,