From patchwork Mon Jul 28 07:22:47 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Wu X-Patchwork-Id: 4632581 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id D5F0E9F3B4 for ; Mon, 28 Jul 2014 07:27:01 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2235A20123 for ; Mon, 28 Jul 2014 07:27:00 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3ED0720117 for ; Mon, 28 Jul 2014 07:26:59 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XBfIe-00084u-RS; Mon, 28 Jul 2014 07:24:48 +0000 Received: from nasmtp01.atmel.com ([192.199.1.245] helo=DVREDG01.corp.atmel.com) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XBfIU-0007wf-E5 for linux-arm-kernel@lists.infradead.org; Mon, 28 Jul 2014 07:24:40 +0000 Received: from apsmtp01.atmel.com (10.168.254.31) by DVREDG01.corp.atmel.com (10.42.103.30) with Microsoft SMTP Server (TLS) id 14.2.347.0; Mon, 28 Jul 2014 01:24:26 -0600 Received: from melon.corp.atmel.com (10.168.254.13) by apsmtp01.atmel.com (10.168.254.31) with Microsoft SMTP Server id 14.2.347.0; Mon, 28 Jul 2014 15:27:30 +0800 From: Josh Wu To: , Subject: [PATCH v4 2/3] media: atmel-isi: convert the pdata from pointer to structure Date: Mon, 28 Jul 2014 15:22:47 +0800 Message-ID: <1406532167-32655-3-git-send-email-josh.wu@atmel.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1406532167-32655-1-git-send-email-josh.wu@atmel.com> References: <1406532167-32655-1-git-send-email-josh.wu@atmel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140728_002438_522184_2C165180 X-CRM114-Status: GOOD ( 13.26 ) X-Spam-Score: -0.6 (/) Cc: Josh Wu , laurent.pinchart@ideasonboard.com, linux-arm-kernel@lists.infradead.org, m.chehab@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now the platform data is initialized by allocation of isi structure. In the future, we use pdata to store the dt parameters. Signed-off-by: Josh Wu --- v3 -> v4: no change. v2 -> v3: use sizeof(isi->pdata) instead of using sizeof(struct). drivers/media/platform/soc_camera/atmel-isi.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/media/platform/soc_camera/atmel-isi.c b/drivers/media/platform/soc_camera/atmel-isi.c index 802c203..74af560 100644 --- a/drivers/media/platform/soc_camera/atmel-isi.c +++ b/drivers/media/platform/soc_camera/atmel-isi.c @@ -84,7 +84,7 @@ struct atmel_isi { struct clk *mck; unsigned int irq; - struct isi_platform_data *pdata; + struct isi_platform_data pdata; u16 width_flags; /* max 12 bits */ struct list_head video_buffer_list; @@ -350,7 +350,7 @@ static void start_dma(struct atmel_isi *isi, struct frame_buffer *buffer) cfg1 &= ~ISI_CFG1_FRATE_DIV_MASK; /* Enable linked list */ - cfg1 |= isi->pdata->frate | ISI_CFG1_DISCR; + cfg1 |= isi->pdata.frate | ISI_CFG1_DISCR; /* Enable codec path and ISI */ ctrl = ISI_CTRL_CDC | ISI_CTRL_EN; @@ -795,7 +795,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd) /* Make choises, based on platform preferences */ if ((common_flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH) && (common_flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) { - if (isi->pdata->hsync_act_low) + if (isi->pdata.hsync_act_low) common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_HIGH; else common_flags &= ~V4L2_MBUS_HSYNC_ACTIVE_LOW; @@ -803,7 +803,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd) if ((common_flags & V4L2_MBUS_VSYNC_ACTIVE_HIGH) && (common_flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) { - if (isi->pdata->vsync_act_low) + if (isi->pdata.vsync_act_low) common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_HIGH; else common_flags &= ~V4L2_MBUS_VSYNC_ACTIVE_LOW; @@ -811,7 +811,7 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd) if ((common_flags & V4L2_MBUS_PCLK_SAMPLE_RISING) && (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING)) { - if (isi->pdata->pclk_act_falling) + if (isi->pdata.pclk_act_falling) common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_RISING; else common_flags &= ~V4L2_MBUS_PCLK_SAMPLE_FALLING; @@ -833,9 +833,9 @@ static int isi_camera_set_bus_param(struct soc_camera_device *icd) if (common_flags & V4L2_MBUS_PCLK_SAMPLE_FALLING) cfg1 |= ISI_CFG1_PIXCLK_POL_ACTIVE_FALLING; - if (isi->pdata->has_emb_sync) + if (isi->pdata.has_emb_sync) cfg1 |= ISI_CFG1_EMB_SYNC; - if (isi->pdata->full_mode) + if (isi->pdata.full_mode) cfg1 |= ISI_CFG1_FULL_MODE; isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS); @@ -910,7 +910,7 @@ static int atmel_isi_probe(struct platform_device *pdev) if (IS_ERR(isi->pclk)) return PTR_ERR(isi->pclk); - isi->pdata = pdata; + memcpy(&isi->pdata, pdata, sizeof(isi->pdata)); isi->active = NULL; spin_lock_init(&isi->lock); INIT_LIST_HEAD(&isi->video_buffer_list); @@ -926,7 +926,7 @@ static int atmel_isi_probe(struct platform_device *pdev) /* Set ISI_MCK's frequency, it should be faster than pixel * clock. */ - ret = clk_set_rate(isi->mck, pdata->mck_hz); + ret = clk_set_rate(isi->mck, isi->pdata.mck_hz); if (ret < 0) return ret; } @@ -960,9 +960,9 @@ static int atmel_isi_probe(struct platform_device *pdev) goto err_ioremap; } - if (pdata->data_width_flags & ISI_DATAWIDTH_8) + if (isi->pdata.data_width_flags & ISI_DATAWIDTH_8) isi->width_flags = 1 << 7; - if (pdata->data_width_flags & ISI_DATAWIDTH_10) + if (isi->pdata.data_width_flags & ISI_DATAWIDTH_10) isi->width_flags |= 1 << 9; isi_writel(isi, ISI_CTRL, ISI_CTRL_DIS);