From patchwork Sat Jun 21 22:19:54 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Jarzmik X-Patchwork-Id: 4395161 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A5F06BEEAA for ; Sat, 21 Jun 2014 22:20:48 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D0C3E20212 for ; Sat, 21 Jun 2014 22:20:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 14759201EC for ; Sat, 21 Jun 2014 22:20:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752632AbaFUWUj (ORCPT ); Sat, 21 Jun 2014 18:20:39 -0400 Received: from smtp05.smtpout.orange.fr ([80.12.242.127]:56455 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752121AbaFUWUi (ORCPT ); Sat, 21 Jun 2014 18:20:38 -0400 Received: from localhost.localdomain ([109.214.175.13]) by mwinf5d62 with ME id HALd1o00H0Hj5R103ALdD0; Sun, 22 Jun 2014 00:20:37 +0200 X-ME-Helo: localhost.localdomain X-ME-Date: Sun, 22 Jun 2014 00:20:37 +0200 X-ME-IP: 109.214.175.13 From: Robert Jarzmik To: g.liakhovetski@gmx.de, devicetree@vger.kernel.org Cc: linux-media@vger.kernel.org, Robert Jarzmik Subject: [PATCH v2 1/2] media: mt8m111: add device-tree suppport Date: Sun, 22 Jun 2014 00:19:54 +0200 Message-Id: <1403389195-17386-1-git-send-email-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.0.0.rc2 Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM, RCVD_IN_DNSWL_HI,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=ham 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 Add device-tree support for mt9m111 camera sensor. Signed-off-by: Robert Jarzmik --- drivers/media/i2c/soc_camera/mt9m111.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/media/i2c/soc_camera/mt9m111.c b/drivers/media/i2c/soc_camera/mt9m111.c index ccf5940..b51e856 100644 --- a/drivers/media/i2c/soc_camera/mt9m111.c +++ b/drivers/media/i2c/soc_camera/mt9m111.c @@ -931,6 +931,12 @@ static int mt9m111_probe(struct i2c_client *client, struct soc_camera_subdev_desc *ssdd = soc_camera_i2c_to_desc(client); int ret; + if (client->dev.of_node) { + ssdd = devm_kzalloc(&client->dev, sizeof(*ssdd), GFP_KERNEL); + if (!ssdd) + return -ENOMEM; + client->dev.platform_data = ssdd; + } if (!ssdd) { dev_err(&client->dev, "mt9m111: driver needs platform data\n"); return -EINVAL; @@ -1015,6 +1021,11 @@ static int mt9m111_remove(struct i2c_client *client) return 0; } +static const struct of_device_id mt9m111_of_match[] = { + { .compatible = "micron,mt9m111", }, + {}, +}; +MODULE_DEVICE_TABLE(of, mt9m111_of_match); static const struct i2c_device_id mt9m111_id[] = { { "mt9m111", 0 }, @@ -1025,6 +1036,7 @@ MODULE_DEVICE_TABLE(i2c, mt9m111_id); static struct i2c_driver mt9m111_i2c_driver = { .driver = { .name = "mt9m111", + .of_match_table = of_match_ptr(mt9m111_of_match), }, .probe = mt9m111_probe, .remove = mt9m111_remove,