From patchwork Wed May 29 18:50:57 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 2632071 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C8E53DF24C for ; Wed, 29 May 2013 18:51:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965791Ab3E2SvA (ORCPT ); Wed, 29 May 2013 14:51:00 -0400 Received: from mail-la0-f47.google.com ([209.85.215.47]:41910 "EHLO mail-la0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965653Ab3E2Su7 (ORCPT ); Wed, 29 May 2013 14:50:59 -0400 Received: by mail-la0-f47.google.com with SMTP id fq12so8939699lab.20 for ; Wed, 29 May 2013 11:50:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=to:subject:cc:from:organization:date:mime-version:content-type :content-transfer-encoding:message-id:x-gm-message-state; bh=TcwKtm5MFmLgr31S4AkR+0ysY8DMAgTvDeXpQLo8lZ0=; b=jCg4eyWVIDVE2GoTyDwDNm3U9R0J9a6miDPowPS7LfMkwgfMjjrrVS8Cof+jlG+j1i VKVBz/SEBCorb2DLfn4m+8bK8B5BRyRIAPPeZRx1zeai5DXPWTPuskbO0f+wEQW41tkv xezhpWqYzdnm2OTi7fiev671W7KUTvm96QwDt6xUvADEN8uMLFGg/6N9LxvKCDBOUVYe Ft/NJZHqBV0W6fEtwUxiLEwh7sI81a6u0tlC3aZFSGL0GgT9eRJpNnsgDF387H5ohH3m VbOI+7CNoHVVzmVZhKJ054WoUTFbae+BIbGJ4AGnQvVoghs2J5ApAotukg1m0zOqHx2M 1n3g== X-Received: by 10.112.171.169 with SMTP id av9mr2223655lbc.130.1369853457839; Wed, 29 May 2013 11:50:57 -0700 (PDT) Received: from wasted.dev.rtsoft.ru (ppp91-76-83-218.pppoe.mtu-net.ru. [91.76.83.218]) by mx.google.com with ESMTPSA id w20sm8597877lbi.14.2013.05.29.11.50.55 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 29 May 2013 11:50:56 -0700 (PDT) To: mchehab@redhat.com, linux-media@vger.kernel.org, hverkuil@xs4all.nl Subject: [PATCH v5] adv7180: add more subdev video ops Cc: vladimir.barinov@cogentembedded.com, linux-sh@vger.kernel.org, matsu@igel.co.jp From: Sergei Shtylyov Organization: Cogent Embedded Date: Wed, 29 May 2013 22:50:57 +0400 MIME-Version: 1.0 Message-Id: <201305292250.57801.sergei.shtylyov@cogentembedded.com> X-Gm-Message-State: ALoCoQl05uwNVrCc1XRdneANppDc0i3wQEgadbMk2rbXBCGTygDFK0wNzQasn//6AVXuhauSj8Np Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org From: Vladimir Barinov Add subdev video ops for ADV7180 video decoder. This makes decoder usable on the soc-camera drivers. Signed-off-by: Vladimir Barinov [Sergei: renamed adv7180_try_mbus_fmt() to adv7180_mbus_fmt().] Signed-off-by: Sergei Shtylyov --- This patch is against the 'media_tree.git' repo. Changes from version 4: - renamed adv7180_try_mbus_fmt() to adv7180_mbus_fmt(). Changes from version 3: - set the field format independent of a video standard in try_mbus_fmt() method; - removed adv7180_g_mbus_fmt(), adv7180_g_mbus_fmt(), and the 'fmt' field from 'struct adv7180_state', and so use adv7180_try_mbus_fmt() to implement both g_mbus_fmt() and s_mbus_fmt() methods; - removed cropcap() method. Changes from version 2: - set the field format depending on video standard in try_mbus_fmt() method; - removed querystd() method calls from try_mbus_fmt() and cropcap() methods; - removed g_crop() method. drivers/media/i2c/adv7180.c | 46 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Index: media_tree/drivers/media/i2c/adv7180.c =================================================================== --- media_tree.orig/drivers/media/i2c/adv7180.c +++ media_tree/drivers/media/i2c/adv7180.c @@ -1,6 +1,8 @@ /* * adv7180.c Analog Devices ADV7180 video decoder driver * Copyright (c) 2009 Intel Corporation + * Copyright (C) 2013 Cogent Embedded, Inc. + * Copyright (C) 2013 Renesas Solutions Corp. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -397,10 +399,54 @@ static void adv7180_exit_controls(struct v4l2_ctrl_handler_free(&state->ctrl_hdl); } +static int adv7180_enum_mbus_fmt(struct v4l2_subdev *sd, unsigned int index, + enum v4l2_mbus_pixelcode *code) +{ + if (index > 0) + return -EINVAL; + + *code = V4L2_MBUS_FMT_YUYV8_2X8; + + return 0; +} + +static int adv7180_mbus_fmt(struct v4l2_subdev *sd, + struct v4l2_mbus_framefmt *fmt) +{ + struct adv7180_state *state = to_state(sd); + + fmt->code = V4L2_MBUS_FMT_YUYV8_2X8; + fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; + fmt->field = V4L2_FIELD_INTERLACED; + fmt->width = 720; + fmt->height = state->curr_norm & V4L2_STD_525_60 ? 480 : 576; + + return 0; +} + +static int adv7180_g_mbus_config(struct v4l2_subdev *sd, + struct v4l2_mbus_config *cfg) +{ + /* + * The ADV7180 sensor supports BT.601/656 output modes. + * The BT.656 is default and not yet configurable by s/w. + */ + cfg->flags = V4L2_MBUS_MASTER | V4L2_MBUS_PCLK_SAMPLE_RISING | + V4L2_MBUS_DATA_ACTIVE_HIGH; + cfg->type = V4L2_MBUS_BT656; + + return 0; +} + static const struct v4l2_subdev_video_ops adv7180_video_ops = { .querystd = adv7180_querystd, .g_input_status = adv7180_g_input_status, .s_routing = adv7180_s_routing, + .enum_mbus_fmt = adv7180_enum_mbus_fmt, + .try_mbus_fmt = adv7180_mbus_fmt, + .g_mbus_fmt = adv7180_mbus_fmt, + .s_mbus_fmt = adv7180_mbus_fmt, + .g_mbus_config = adv7180_g_mbus_config, }; static const struct v4l2_subdev_core_ops adv7180_core_ops = {