Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp2321940ybt; Tue, 16 Jun 2020 03:02:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzvM0UqgZbhp1gRCbYuy6INhGAtMd9nwDcNNGwX+s7nXRDViy2DgTCdgYvXVASihFz6HhC7 X-Received: by 2002:a17:906:edaf:: with SMTP id sa15mr2089557ejb.175.1592301778134; Tue, 16 Jun 2020 03:02:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592301778; cv=none; d=google.com; s=arc-20160816; b=NJPXBStCPmlGxaOyXh3LYxlSjNVc1+9ATKfFNz07JV0VlPlARaKHN/l5++v5VL3RMV VKYiQ6UEbU4py6VhWPujTlWzdnCqlfxYx0cMnEzVGZsrjeXcWUQFDuHeFBAwekK17+PR wdmrwp7msBMQx4yknNxye1/8ZbXPiX9qdRW+qVIHOUgKnx0MhfdFJyHyX4HQTuCLgW12 WQlQ1gmDKf60M4V0ujLlXD0NQxgts+FRkYzWbcf71SXAxgx/56bGiRiaI1SOUlRGlgEN 7A1vt+McmmWgLOkmVVCnnbYypH5+LTI9je7PmNyvv21cdd1SrJdIfZllhg2oEV6OtUyE TLsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=vJoCGWBM3FulpvcIxiGM6HBKvpIm2DEEUFUFAruqCgw=; b=szt2d1rKzIBjHDgIQ/jZZSSVD7nXwFJPVKSdJotbYjzdSr30UCE/WxPHYtQ5qe/eTW M4mgrv9XT8K5GnSTk+fGEjWtTlxgGRobP0YWb+UUmGsst4Wm77iidRxT8/XpUPBFRQBm U6VnwgFCxzOkV5LHo2EigbO6sONLGExhE/5NWfqQl3vWdDNHkAOtOJkzoMF+QQFFAQF1 WHmOh0oIje0+ElKNRHvVru+ujcsJBsMdMbYILMeHSSzjbofH22qWL7NgrGJDwcWYmXH4 UItruNUnt+vTEzA4GTVJpQuZlAAuv6+U4hgjIDii7T7o9wROmPg4tj55+95RkIiaMNcZ yfnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r3si10895869ejx.238.2020.06.16.03.02.35; Tue, 16 Jun 2020 03:02:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728194AbgFPKAn (ORCPT + 99 others); Tue, 16 Jun 2020 06:00:43 -0400 Received: from smtp1.de.adit-jv.com ([93.241.18.167]:36126 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726052AbgFPKAi (ORCPT ); Tue, 16 Jun 2020 06:00:38 -0400 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 38AF43C0579; Tue, 16 Jun 2020 12:00:36 +0200 (CEST) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id wZY7WntlG0fp; Tue, 16 Jun 2020 12:00:31 +0200 (CEST) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 029253C00BA; Tue, 16 Jun 2020 12:00:31 +0200 (CEST) Received: from vmlxhi-110.adit-jv.com (10.72.93.196) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.487.0; Tue, 16 Jun 2020 12:00:30 +0200 From: Ramzi BEN MEFTAH To: Kieran Bingham , Mauro Carvalho Chehab , Hans Verkuil , Sakari Ailus , Janusz Krzysztofik , Jacopo Mondi , Steve Longerbeam , Ezequiel Garcia , Arnd Bergmann , , CC: Michael Rodin , , Subject: [PATCH 2/3] media: i2c: adv748x-afe: Implement enum/get/set input Date: Tue, 16 Jun 2020 12:00:16 +0200 Message-ID: <1592301619-17631-2-git-send-email-rbmeftah@de.adit-jv.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com> References: <1592301619-17631-1-git-send-email-rbmeftah@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.72.93.196] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve Longerbeam The adv748x-afe sub-device driver does not support changing the analog input, so enuminput returns only the status of a single input at index=0. Likewise g_input returns only index 0, and s_input returns -EINVAL if index is not 0, and otherwise does nothing. Signed-off-by: Steve Longerbeam (cherry picked from ADIT v4.14 commit 8aadc35d3ae252a1eaed8506fbd1675911465bbd) --- drivers/media/i2c/adv748x/adv748x-afe.c | 42 ++++++++++++++++++++++++++++++--- 1 file changed, 39 insertions(+), 3 deletions(-) diff --git a/drivers/media/i2c/adv748x/adv748x-afe.c b/drivers/media/i2c/adv748x/adv748x-afe.c index dbbb1e4..6b090f4 100644 --- a/drivers/media/i2c/adv748x/adv748x-afe.c +++ b/drivers/media/i2c/adv748x/adv748x-afe.c @@ -154,7 +154,7 @@ static void adv748x_afe_set_video_standard(struct adv748x_state *state, (sdpstd & 0xf) << ADV748X_SDP_VID_SEL_SHIFT); } -static int adv748x_afe_s_input(struct adv748x_afe *afe, unsigned int input) +static int adv748x_afe_set_input(struct adv748x_afe *afe, unsigned int input) { struct adv748x_state *state = adv748x_afe_to_state(afe); @@ -267,6 +267,39 @@ static int adv748x_afe_g_input_status(struct v4l2_subdev *sd, u32 *status) return ret; } +static int adv748x_afe_enuminput(struct v4l2_subdev *sd, + struct v4l2_input *input) +{ + struct adv748x_afe *afe = adv748x_sd_to_afe(sd); + + if (input->index != 0) + return -EINVAL; + + input->type = V4L2_INPUT_TYPE_CAMERA; + input->capabilities = V4L2_IN_CAP_STD; + input->status = V4L2_IN_ST_NO_SIGNAL; + /* API says we must return all supported standards */ + input->std = V4L2_STD_ALL; + + snprintf(input->name, sizeof(input->name), "%s AIN%u", + sd->name, afe->input); + + return adv748x_afe_g_input_status(sd, &input->status); +} + +static int adv748x_afe_g_input(struct v4l2_subdev *sd, u32 *index) +{ + *index = 0; + return 0; +} + +static int adv748x_afe_s_input(struct v4l2_subdev *sd, u32 index) +{ + if (index != 0) + return -EINVAL; + return 0; +} + static int adv748x_afe_s_stream(struct v4l2_subdev *sd, int enable) { struct adv748x_afe *afe = adv748x_sd_to_afe(sd); @@ -277,7 +310,7 @@ static int adv748x_afe_s_stream(struct v4l2_subdev *sd, int enable) mutex_lock(&state->mutex); if (enable) { - ret = adv748x_afe_s_input(afe, afe->input); + ret = adv748x_afe_set_input(afe, afe->input); if (ret) goto unlock; } @@ -306,6 +339,9 @@ static const struct v4l2_subdev_video_ops adv748x_afe_video_ops = { .querystd = adv748x_afe_querystd, .g_tvnorms = adv748x_afe_g_tvnorms, .g_input_status = adv748x_afe_g_input_status, + .enuminput = adv748x_afe_enuminput, + .g_input = adv748x_afe_g_input, + .s_input = adv748x_afe_s_input, .s_stream = adv748x_afe_s_stream, .g_pixelaspect = adv748x_afe_g_pixelaspect, }; @@ -520,7 +556,7 @@ int adv748x_afe_init(struct adv748x_afe *afe) } } - adv748x_afe_s_input(afe, afe->input); + adv748x_afe_set_input(afe, afe->input); adv_dbg(state, "AFE Default input set to %d\n", afe->input); -- 2.7.4