From patchwork Mon Jun 10 21:23:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Hesselbarth X-Patchwork-Id: 2699981 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by patchwork1.kernel.org (Postfix) with ESMTP id A565740077 for ; Tue, 11 Jun 2013 05:41:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A9B1E6329 for ; Mon, 10 Jun 2013 22:41:52 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-bk0-f51.google.com (mail-bk0-f51.google.com [209.85.214.51]) by gabe.freedesktop.org (Postfix) with ESMTP id A1391E5CE2 for ; Mon, 10 Jun 2013 14:23:53 -0700 (PDT) Received: by mail-bk0-f51.google.com with SMTP id ji1so2811112bkc.24 for ; Mon, 10 Jun 2013 14:23:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer; bh=hR4GQNzym6QiWcT6HLj7eK8cH8OcZNKQ0PHpjAQZ97Q=; b=waNvTKah8BRZO6YVulnHPHo5353mIAUl1dgaNygziPhXs8kt5Q8opnfGRt7irr+wdn vGYDk/h8l7JMYRS4CtehYpo1gxciLSnaKkDuCsTJBCb/nI/u5avYal/dYZNKtdkDFff4 dA4V0RZShoTc5ImxB1Xupi7Pyb0QWh1sXNSWdRDTgBPOogt/fsK2TNcwfuP0PSceXVAr N/Lev3dzmU/e82A6aPw3ehVt0UoFJ/9X646U2GuLgXMR+xunX3Pbjkd0yldQdQb1izKp 7fN1VoIO+cdPuEXl8MzNNrrlBlkC0JdqJ8CyyNOhwicX2sAYbwocvGRmQjkasTH+mCzn SQlA== X-Received: by 10.204.71.200 with SMTP id i8mr1796814bkj.116.1370899432674; Mon, 10 Jun 2013 14:23:52 -0700 (PDT) Received: from topkick.lan (dslc-082-083-251-181.pools.arcor-ip.net. [82.83.251.181]) by mx.google.com with ESMTPSA id tl1sm4544394bkb.7.2013.06.10.14.23.51 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 14:23:51 -0700 (PDT) Received: from picnic.unix.mst.uni-hannover.de (firewall.mst.uni-hannover.de [130.75.30.51]) by topkick.lan (Postfix) with ESMTPSA id CBCF35F973; Mon, 10 Jun 2013 23:22:39 +0200 (CEST) From: Sebastian Hesselbarth To: Sebastian Hesselbarth Subject: [PATCH] drm: encoder_slave: respect of_node on i2c encoder init Date: Mon, 10 Jun 2013 23:23:42 +0200 Message-Id: <1370899422-1281-1-git-send-email-sebastian.hesselbarth@gmail.com> X-Mailer: git-send-email 1.7.2.5 X-Mailman-Approved-At: Mon, 10 Jun 2013 22:36:19 -0700 Cc: Russell King - ARM Linux , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, Sebastian Hesselbarth X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Current DRM slave encoder API conflicts with auto-registration of i2c client when using DT probed clients. To allow DRM slave encoders passed by DT, this patch adds a check to drm_i2c_encoder_init for a non-NULL .of_node on i2c_board_info and calls an of_i2c helper to get the i2c client device instead of registering a new device. Signed-off-by: Sebastian Hesselbarth --- Cc: David Airlie Cc: Russell King - ARM Linux Cc: Darren Etheridge Cc: linux-arm-kernel@lists.infradead.org Cc: dri-devel@lists.freedesktop.org Cc: linux-kernel@vger.kernel.org --- drivers/gpu/drm/drm_encoder_slave.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/gpu/drm/drm_encoder_slave.c b/drivers/gpu/drm/drm_encoder_slave.c index 0cfb60f..36c0aa7 100644 --- a/drivers/gpu/drm/drm_encoder_slave.c +++ b/drivers/gpu/drm/drm_encoder_slave.c @@ -25,6 +25,7 @@ */ #include +#include #include @@ -61,7 +62,10 @@ int drm_i2c_encoder_init(struct drm_device *dev, request_module("%s%s", I2C_MODULE_PREFIX, info->type); - client = i2c_new_device(adap, info); + if (info->of_node) + client = of_find_i2c_device_by_node(info->of_node); + else + client = i2c_new_device(adap, info); if (!client) { err = -ENOMEM; goto fail;