From patchwork Mon Mar 11 19:44:46 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Sylwester Nawrocki/Kernel \\(PLT\\) /SRPOL/Staff Engineer/Samsung Electronics" X-Patchwork-Id: 2250521 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id A230E3FC8F for ; Mon, 11 Mar 2013 19:49:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UF8f7-000386-Gu; Mon, 11 Mar 2013 19:45:33 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UF8eu-00034E-Dj for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2013 19:45:24 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MJI00FDDHJEMD00@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 12 Mar 2013 04:45:16 +0900 (KST) X-AuditID: cbfee61a-b7fa86d0000045ae-50-513e344c8ae4 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 01.65.17838.C443E315; Tue, 12 Mar 2013 04:45:16 +0900 (KST) Received: from amdc1344.digital.local ([106.116.147.32]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0MJI00E2LHIVRD40@mmp2.samsung.com>; Tue, 12 Mar 2013 04:45:16 +0900 (KST) From: Sylwester Nawrocki To: linux-media@vger.kernel.org Subject: [RFC PATCH 2/8] s5p-fimc: Add FIMC-IS ISP I2C bus driver Date: Mon, 11 Mar 2013 20:44:46 +0100 Message-id: <1363031092-29950-3-git-send-email-s.nawrocki@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1363031092-29950-1-git-send-email-s.nawrocki@samsung.com> References: <1363031092-29950-1-git-send-email-s.nawrocki@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrKLMWRmVeSWpSXmKPExsVy+t9jQV0fE7tAg4/TlCxurTvHavHx1G1W iwOzH7JaXD9vZ3G26Q27xabH11gtejZsZbWYcX4fk8XtxhVsFofftLNarNs5id2B22PnrLvs HpuX1Hucn7GQ0aNvyypGj8+b5AJYo7hsUlJzMstSi/TtErgyHr+YylRwTqmia8FDtgbGRtku Rk4OCQETiS2v5rJD2GISF+6tZwOxhQSmM0psXM3RxcgFZHcwSXxrOwBWxCZgKNF7tI8RxBYR kJd40nuDDaSIWWAzk8TRa2/AioQFHCW6ZzQxg9gsAqoSc2euZQKxeQXcJKat3A9UwwG0TUFi ziQbkDCngLvEgt6/7BCL3SS65vczTWDkXcDIsIpRNLUguaA4KT3XUK84Mbe4NC9dLzk/dxMj OPCeSe1gXNlgcYhRgINRiYdX8ZttoBBrYllxZe4hRgkOZiUR3pWbbAKFeFMSK6tSi/Lji0pz UosPMUpzsCiJ8x5otQ4UEkhPLEnNTk0tSC2CyTJxcEo1MM5N+qP2aCKHlFqFhFGLXuDltyfE mVNOtXn9DWTNSKvWu813PFeKP17FIGvVPxWuhgKH50KsVj/U4+s8FF+fUTV9xORp/tb/czDL wcNF9joBDDXNNZwb9u/fJyHvFHFVLz7ubOrGME6Dak69C+6v2JXX+uqsf8gjEhk+oVR1ydMJ XzZ5Hc5TYinOSDTUYi4qTgQAH8aNQTgCAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130311_154521_951300_D64D14DC X-CRM114-Status: GOOD ( 18.49 ) X-Spam-Score: -9.3 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [203.254.224.24 listed in list.dnswl.org] -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -2.4 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-samsung-soc@vger.kernel.org, shaik.samsung@gmail.com, devicetree-discuss@lists.ozlabs.org, dh09.lee@samsung.com, a.hajda@samsung.com, kyungmin.park@samsung.com, myungjoo.ham@samsung.com, linux-arm-kernel@lists.infradead.org, Sylwester Nawrocki , arun.kk@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This patch adds the ISP I2C bus controller driver files. Creating a standard I2C bus adapter, even if the driver doesn't actually communicates with the hardware and it is instead used by the ISP firmware running on the Cortex-A5, allows to use standard hardware description in the device tree. As the sensor would have actually had a standard V4L2 sub-device driver run on the host CPU. This approach allows to adapt the driver with a relatively small effort should the Imaging Subsystem architecture change so that the I2C bus is controlled by the host CPU, rather than the internal FIMC-IS ARM CPU. The image sensor drivers can be standard I2C client driver, as in case of most existing image sensor driver. Signed-off-by: Sylwester Nawrocki Signed-off-by: Kyungmin Park --- drivers/media/platform/s5p-fimc/fimc-is-i2c.c | 81 +++++++++++++++++++++++++ drivers/media/platform/s5p-fimc/fimc-is-i2c.h | 15 +++++ 2 files changed, 96 insertions(+) create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-i2c.c create mode 100644 drivers/media/platform/s5p-fimc/fimc-is-i2c.h diff --git a/drivers/media/platform/s5p-fimc/fimc-is-i2c.c b/drivers/media/platform/s5p-fimc/fimc-is-i2c.c new file mode 100644 index 0000000..d4c75dc --- /dev/null +++ b/drivers/media/platform/s5p-fimc/fimc-is-i2c.c @@ -0,0 +1,81 @@ +/* + * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Sylwester Nawrocki + * + * 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 + * published by the Free Software Foundation. + */ +#define pr_fmt(fmt) "%s:%d " fmt, __func__, __LINE__ + +#include +#include +#include +#include "fimc-is-i2c.h" + +/* + * An empty algorithm is used as the actual I2C bus controller driver + * is implemented in the FIMC-IS subsystem firmware and the host CPU + * doesn't touch the hardware. + */ +static const struct i2c_algorithm fimc_is_i2c_algorithm; + +static int fimc_is_i2c_probe(struct platform_device *pdev) +{ + struct device_node *node = pdev->dev.of_node; + struct i2c_adapter *i2c_adap; + int ret; + + i2c_adap = devm_kzalloc(&pdev->dev, sizeof(*i2c_adap), GFP_KERNEL); + + i2c_adap->dev.of_node = node; + i2c_adap->dev.parent = &pdev->dev; + strlcpy(i2c_adap->name, "exynos4x12-is-i2c", sizeof(i2c_adap->name)); + i2c_adap->owner = THIS_MODULE; + i2c_adap->algo = &fimc_is_i2c_algorithm; + i2c_adap->class = I2C_CLASS_SPD; + + ret = i2c_add_adapter(i2c_adap); + if (ret < 0) { + dev_err(&pdev->dev, "failed to add I2C bus %s\n", + node->full_name); + return ret; + } + of_i2c_register_devices(i2c_adap); + + return 0; +} + +static int fimc_is_i2c_remove(struct platform_device *pdev) +{ + return 0; +} + +static const struct of_device_id fimc_is_i2c_of_match[] = { + { .compatible = FIMC_IS_I2C_COMPATIBLE }, + { }, +}; +MODULE_DEVICE_TABLE(of, fimc_is_i2c_of_match); + +static struct platform_driver fimc_is_i2c_driver = { + .probe = fimc_is_i2c_probe, + .remove = fimc_is_i2c_remove, + .driver = { + .of_match_table = fimc_is_i2c_of_match, + .name = "fimc-is-i2c", + .owner = THIS_MODULE, + } +}; + +int fimc_is_register_i2c_driver(void) +{ + return platform_driver_register(&fimc_is_i2c_driver); +} + +void fimc_is_unregister_i2c_driver(void) +{ + platform_driver_unregister(&fimc_is_i2c_driver); +} + diff --git a/drivers/media/platform/s5p-fimc/fimc-is-i2c.h b/drivers/media/platform/s5p-fimc/fimc-is-i2c.h new file mode 100644 index 0000000..0d38d6b --- /dev/null +++ b/drivers/media/platform/s5p-fimc/fimc-is-i2c.h @@ -0,0 +1,15 @@ +/* + * Samsung EXYNOS4x12 FIMC-IS (Imaging Subsystem) driver + * + * Copyright (C) 2013 Samsung Electronics Co., Ltd. + * Sylwester Nawrocki + * + * 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 + * published by the Free Software Foundation. + */ + +#define FIMC_IS_I2C_COMPATIBLE "samsung,exynos4212-i2c-isp" + +int fimc_is_register_i2c_driver(void); +void fimc_is_unregister_i2c_driver(void);