Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp844802ybf; Fri, 28 Feb 2020 08:42:17 -0800 (PST) X-Google-Smtp-Source: APXvYqw80PPPrB5EKkCPGKTrnGnA4s0yTP6tlvMYU1AjPL3X+ODazdxC7dai7RebdK/JvXCS8d3a X-Received: by 2002:a05:6830:1608:: with SMTP id g8mr3870840otr.169.1582908136843; Fri, 28 Feb 2020 08:42:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582908136; cv=none; d=google.com; s=arc-20160816; b=eCOTfgmPp+9+tgi82grS6XaFDBBrSQpCZ3aLTMXSMq/vUwnYajlque4aW8cNn58rUm 6t/HWsG3fEppCgliFaOQUTS/3TxvPX5Nwfdc6/LlnSv8w85DJqQeN5bDDIELy059pOnK aaZIp0yrNxoEM0yENSfQZxLR2s5zI6FR82Gyxb1euTdbps2iESexPwaiHU1u6S2v7Daz nL0m7uAJOqSmr7Jel3X5Ws7FXKp1tnJe125/kR4ga3MxUrK/O3siC/5b//JFTuv/LcRU vfV3zyKZnZpp0NphYvP9q1uEwPVj3SzO4GLGo2fsO83F2eRafIO9LdFwzbJE6evSOyri T6+g== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=X5lwKhEkYPb9uFlg3S0kiEOPjUxyOuwawAZ72KaGw1I=; b=tPeUcRZatWEJ8UIkX5uSkStkU1yRn7pZTPTTR0AD+th4Gap7EmPOblnMkUODG2M27N q75mEoDnNuMHf1bokv73yZ0d/eptDOvRuqlGB16xhgPGGlyzu31RnT36jT8tAkb5cFyy tjKKyK5tpyNrVpVWAAHKwGa7hSIUmWrLRLjf5VxbHDsFndg/PLYFTcWYv46Xz4GEU/pL XrFZhIFF//JJNZ9hyE18YsEptm7kAP2KUHfytCEC6d4mnGFuM/C0LZOyWGZHCB4d6r4O Z2ktgY9pYF+eTPLvsoE2k8F2CSju4WBRGE5baDgfpM/rLCdNLi8TVzK7ogl1mNqAtSNZ 8bLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=czUtcTbX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q195si2255977oic.83.2020.02.28.08.42.05; Fri, 28 Feb 2020 08:42:16 -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=@gmail.com header.s=20161025 header.b=czUtcTbX; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbgB1Qle (ORCPT + 99 others); Fri, 28 Feb 2020 11:41:34 -0500 Received: from mail-wm1-f66.google.com ([209.85.128.66]:53706 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725928AbgB1Qld (ORCPT ); Fri, 28 Feb 2020 11:41:33 -0500 Received: by mail-wm1-f66.google.com with SMTP id f15so3844030wml.3; Fri, 28 Feb 2020 08:41:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X5lwKhEkYPb9uFlg3S0kiEOPjUxyOuwawAZ72KaGw1I=; b=czUtcTbXEvp4mZ7wtGwtLvOLqcZDZlcZuz3vhgz+v/+rlvyULWIomKGtLHqP8fikwu g83gvPCTOCs5rTKZgRIL6gVLYZggOrS5iRFJmwgwj5iIISr9NRYe3v7hdocYspriLyOx zQ0xYB9h0wlpxsoi0pb/IMf/O+nB/jgyii3rlke9Hlgn7k3pBu0uGLW/i/11iKeTscB0 Roghbmt5MLisRFksRBXU6TGaUQfpebPc5oBID2VTurhw3Wglf7nVzXv0+j0kgJLI5bNq 1eXN0OSorz7i52T937g+ngq+oIh2jMPqLT/316e443cQip13YNuFNi/+/QOoDsIzZcIh bD+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=X5lwKhEkYPb9uFlg3S0kiEOPjUxyOuwawAZ72KaGw1I=; b=C8p6n2Ekn4YBljw7ZtkpzHvkkYsXi3Jz+noe3vpgobHMasS2Y4RBRkk+1Mkm/Rwk3W 6H/UDDjAlrjttAUYipoN8EaZd7U8uCMKE9GrusYor13+DiuY9Qtg4ZnkiDs4TBsT8qp2 XgO+30H3gyHnel1ftUOvLrbuDnThvp+9wNTe2khUt65WApDR9f/s3JBXNT7zpueHbJ7a gk1WVP82rsA+RjeROjiwuPWzZpI60MYg/DXbzz2czfacKoYuNg/iKZWLGmuoW5DWdytU OZkc931htUQjKykfDh3+YpH/pD4gWm5J6Y4btpECbANCZvyyZPG1BpTmwvjIMw7YnmGW PHhQ== X-Gm-Message-State: APjAAAWfS2jt8eaeb/GflR2ENcTzh3HOoZ1gcHdmLnv8yvPzdpcNrikt JVhb8/Rci1GdR+XjpE36Aec= X-Received: by 2002:a1c:a9d1:: with SMTP id s200mr5766137wme.181.1582908091322; Fri, 28 Feb 2020 08:41:31 -0800 (PST) Received: from prasmi.home ([2a00:23c8:2510:d000:3855:fd13:6b76:a11b]) by smtp.gmail.com with ESMTPSA id t187sm3028493wmt.25.2020.02.28.08.41.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Feb 2020 08:41:30 -0800 (PST) From: Lad Prabhakar X-Google-Original-From: Lad Prabhakar To: Mauro Carvalho Chehab , Sakari Ailus , Fabio Estevam Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Lad Prabhakar Subject: [PATCH] media: i2c: ov5645: Add virtual_channel module parameter Date: Fri, 28 Feb 2020 16:41:26 +0000 Message-Id: <20200228164126.17517-1-prabhakar.mahadev-lad.rj@bp.renesas.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org OV5645 can operate in virtual channel 0-3 in CSI2 interfaces, this patch adds support for module parameter virtual_channel to select the required channel. By default OV5645 operates in virtual channel 0. Signed-off-by: Lad Prabhakar --- drivers/media/i2c/ov5645.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/media/i2c/ov5645.c b/drivers/media/i2c/ov5645.c index a6c17d15d754..0a0671164623 100644 --- a/drivers/media/i2c/ov5645.c +++ b/drivers/media/i2c/ov5645.c @@ -54,6 +54,7 @@ #define OV5645_TIMING_TC_REG21 0x3821 #define OV5645_SENSOR_MIRROR BIT(1) #define OV5645_MIPI_CTRL00 0x4800 +#define OV5645_REG_DEBUG_MODE 0x4814 #define OV5645_PRE_ISP_TEST_SETTING_1 0x503d #define OV5645_TEST_PATTERN_MASK 0x3 #define OV5645_SET_TEST_PATTERN(x) ((x) & OV5645_TEST_PATTERN_MASK) @@ -61,6 +62,11 @@ #define OV5645_SDE_SAT_U 0x5583 #define OV5645_SDE_SAT_V 0x5584 +static u8 virtual_channel; +module_param(virtual_channel, byte, 0644); +MODULE_PARM_DESC(virtual_channel, + "MIPI CSI-2 virtual channel (0..3), default 0"); + /* regulator supplies */ static const char * const ov5645_supply_name[] = { "vdddo", /* Digital I/O (1.8V) supply */ @@ -983,12 +989,34 @@ static int ov5645_get_selection(struct v4l2_subdev *sd, return 0; } +static int ov5645_set_virtual_channel(struct ov5645 *ov5645) +{ + u8 temp, channel = virtual_channel; + int ret; + + if (channel > 3) + return -EINVAL; + + ret = ov5645_read_reg(ov5645, OV5645_REG_DEBUG_MODE, &temp); + if (ret) + return ret; + + temp &= ~(3 << 6); + temp |= (channel << 6); + + return ov5645_write_reg(ov5645, OV5645_REG_DEBUG_MODE, temp); +} + static int ov5645_s_stream(struct v4l2_subdev *subdev, int enable) { struct ov5645 *ov5645 = to_ov5645(subdev); int ret; if (enable) { + ret = ov5645_set_virtual_channel(ov5645); + if (ret < 0) + return ret; + ret = ov5645_set_register_array(ov5645, ov5645->current_mode->data, ov5645->current_mode->data_size); -- 2.20.1