From patchwork Mon Mar 5 09:35:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 10258491 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CE64560365 for ; Mon, 5 Mar 2018 09:38:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BC57E289AF for ; Mon, 5 Mar 2018 09:38:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B0826289B2; Mon, 5 Mar 2018 09:38:32 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3DF68289AF for ; Mon, 5 Mar 2018 09:38:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3cBd2GX3u250em2MeQcQ5W25azpl9w83WyeqIBINRxQ=; b=JqsgGtS9yLIiHouMFV52IXdfdn LlcIC4Ca/RJmJ8ONoBDOAB8yRSN/0dtZQuEqx8R325zn2ia/f5KRtgldyNgtKXPlhDxbpAxWBdZxn oZTwEgY5Dwh0+Rltp04eeqTqC9WoR00iPVIZvPW4+M/1BMQ6jaWwm9tfOoPVge0Kc1Yo75xa5oBhb rE9bzKt/v7HkAjnbXZnsWncJnpG/Rik1rhrSLOhqiXyWjVjg/H9GAKP4iWEmP6BDpJOJ5Rzn26EkA idyBUf5RqAO+VPzDschmybtyUNvIFdiRJr5rW3j3hN7o6vzRtOlYdQTIWPnnkWwDL6XgPSjqabSSZ cHLR4nzQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esmZc-0005l0-Kw; Mon, 05 Mar 2018 09:38:24 +0000 Received: from mail.bootlin.com ([62.4.15.54]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1esmXH-0004U9-9Q for linux-arm-kernel@lists.infradead.org; Mon, 05 Mar 2018 09:36:04 +0000 Received: by mail.bootlin.com (Postfix, from userid 110) id C0361207CA; Mon, 5 Mar 2018 10:35:47 +0100 (CET) Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.bootlin.com (Postfix) with ESMTPSA id 5F746207D4; Mon, 5 Mar 2018 10:35:37 +0100 (CET) From: Maxime Ripard To: Yong Deng Subject: [PATCH 3/7] media: sun6i: Pass the sun6i_csi_dev pointer to our helpers Date: Mon, 5 Mar 2018 10:35:30 +0100 Message-Id: <20180305093535.11801-4-maxime.ripard@bootlin.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180305093535.11801-1-maxime.ripard@bootlin.com> References: <1519697113-32202-1-git-send-email-yong.deng@magewell.com> <20180305093535.11801-1-maxime.ripard@bootlin.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180305_013559_733380_BB9730C2 X-CRM114-Status: GOOD ( 11.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mylene Josserand , Thomas Petazzoni , Maxime Ripard , Chen-Yu Tsai , Hans Verkuil , Sakari Ailus , Mauro Carvalho Chehab , linux-arm-kernel@lists.infradead.org, linux-media@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Some helpers need to log some errors for example when we don't support the format passed as an argument. However, we don't currently have a dev pointer available in those functions, preventing us from using any dev_* logging function. Fix that by passing the sun6i_csi_dev structure as an argument, which itself contains a pointer to our struct device. Signed-off-by: Maxime Ripard --- drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c index b0ac8a188f92..f10c3bc2a6c5 100644 --- a/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c +++ b/drivers/media/platform/sunxi/sun6i-csi/sun6i_csi.c @@ -225,7 +225,8 @@ int sun6i_csi_set_power(struct sun6i_csi *csi, bool enable) return 0; } -static enum csi_input_fmt get_csi_input_format(u32 mbus_code, u32 pixformat) +static enum csi_input_fmt get_csi_input_format(struct sun6i_csi_dev *sdev, + u32 mbus_code, u32 pixformat) { /* bayer */ if ((mbus_code & 0xF000) == 0x3000) @@ -242,11 +243,12 @@ static enum csi_input_fmt get_csi_input_format(u32 mbus_code, u32 pixformat) } /* not support YUV420 input format yet */ - pr_debug("Select YUV422 as default input format of CSI.\n"); + dev_dbg(sdev->dev, "Select YUV422 as default input format of CSI.\n"); return CSI_INPUT_FORMAT_YUV422; } -static enum csi_output_fmt get_csi_output_format(u32 pixformat, u32 field) +static enum csi_output_fmt get_csi_output_format(struct sun6i_csi_dev *sdev, + u32 pixformat, u32 field) { bool buf_interlaced = false; @@ -304,7 +306,8 @@ static enum csi_output_fmt get_csi_output_format(u32 pixformat, u32 field) return CSI_FIELD_RAW_8; } -static enum csi_input_seq get_csi_input_seq(u32 mbus_code, u32 pixformat) +static enum csi_input_seq get_csi_input_seq(struct sun6i_csi_dev *sdev, + u32 mbus_code, u32 pixformat) { switch (pixformat) { @@ -449,13 +452,16 @@ static void sun6i_csi_set_format(struct sun6i_csi_dev *sdev) CSI_CH_CFG_HFLIP_EN | CSI_CH_CFG_FIELD_SEL_MASK | CSI_CH_CFG_INPUT_SEQ_MASK); - val = get_csi_input_format(csi->config.code, csi->config.pixelformat); + val = get_csi_input_format(sdev, csi->config.code, + csi->config.pixelformat); cfg |= CSI_CH_CFG_INPUT_FMT(val); - val = get_csi_output_format(csi->config.pixelformat, csi->config.field); + val = get_csi_output_format(sdev, csi->config.pixelformat, + csi->config.field); cfg |= CSI_CH_CFG_OUTPUT_FMT(val); - val = get_csi_input_seq(csi->config.code, csi->config.pixelformat); + val = get_csi_input_seq(sdev, csi->config.code, + csi->config.pixelformat); cfg |= CSI_CH_CFG_INPUT_SEQ(val); if (csi->config.field == V4L2_FIELD_TOP)