From patchwork Mon Sep 5 19:43:17 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 9315379 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 577D6607D3 for ; Tue, 6 Sep 2016 00:40:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 48DFC288EE for ; Tue, 6 Sep 2016 00:40:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3B4B528908; Tue, 6 Sep 2016 00:40:39 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4F5DA288EE for ; Tue, 6 Sep 2016 00:40:37 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 301DC6E51F; Tue, 6 Sep 2016 00:40:34 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x234.google.com (mail-lf0-x234.google.com [IPv6:2a00:1450:4010:c07::234]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2B8BF6E12E for ; Mon, 5 Sep 2016 19:43:22 +0000 (UTC) Received: by mail-lf0-x234.google.com with SMTP id h127so29100239lfh.0 for ; Mon, 05 Sep 2016 12:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:organization:user-agent :mime-version:content-transfer-encoding; bh=nZw4mEPgtEr1Iuo3bYXQV3Zucl9wqe4QqhE15c39O+4=; b=Suy7eD4ztoLSh8Clw7dNZ9LC5X7yvbBr+yDrdDEDGZbXXeXX1JglaETIVWRjuKG1td vWM5oRPZdsGfyGSmla82mCGkIYJ5NXPsgXPAJUhQd1A2P+rkZZo9vGDNiBfZrXGcS5PS TMS0mC6yZ7+MGhWMDYDYK9zymyvYD8f8qTJhRZ2yTPZxMrO1J4CkFE3IyOJFQ5ZYOUZl nrjuYVl3g0XulHtAHYi7WTq0ERIVEhzfrWnUyBP3gpoeACjgwBBNEnPWOKxC94ZDN+Dy L27ETWBEivLfudKUbwctS8CH0Y7aNYcUF8Fw1984YaAmKmlqDu7/kQzX2/ZqtKE4VB1T w75A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:mime-version:content-transfer-encoding; bh=nZw4mEPgtEr1Iuo3bYXQV3Zucl9wqe4QqhE15c39O+4=; b=gWDOVpUvCF0XL1aQDIhiLGbsaCCG8xwLT3alJRJE+APgyx900pFZ/rG7ru7gbMpGZk 8uL7l3Dz2Xl+wpk433FLAUisVBYwbxsxsJhiI/pVOPb9vzmYROpj7UN7UjYxQZsBwAHK UlhU0jYkIUg6Bf3D+4NYf8olHmHhJaH6koyLD0osd+seHc9fzNH38t9KpPJMAPDqyrQo QN/IiFIhikPJgmKLYK9sTpycqh+DKkBZo/6s2l0ZKYnXwoweXSRADL2liJl/r8SbQiwC NsRoW25YszWPdFUWuZnxW/h6hyluJVJja2ZL4qN6Fjp4s6516rmz+0j6gVzIQl/vW7Fw jxpw== X-Gm-Message-State: AE9vXwM/I/sGLc4KHRZPMGOX2zZUJupGYz6H4Fx7enDHEl/5Edb31Fst54DWvaYCxzcFrQ== X-Received: by 10.25.146.19 with SMTP id u19mr8731104lfd.206.1473104600386; Mon, 05 Sep 2016 12:43:20 -0700 (PDT) Received: from wasted.cogentembedded.com ([31.173.81.57]) by smtp.gmail.com with ESMTPSA id x1sm364821lfi.9.2016.09.05.12.43.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Sep 2016 12:43:19 -0700 (PDT) From: Sergei Shtylyov To: airlied@linux.ie, dri-devel@lists.freedesktop.org Subject: [PATCH v2] drm/bridge: adv7511: add support for the 2nd chip Date: Mon, 05 Sep 2016 22:43:17 +0300 Message-ID: <1580212.O1LYdJFM97@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.10 (Linux/4.7.2-101.fc23.x86_64; KDE/4.14.20; x86_64; ; ) MIME-Version: 1.0 X-Mailman-Approved-At: Tue, 06 Sep 2016 00:40:33 +0000 Cc: linux-renesas-soc@vger.kernel.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP The Renesas Wheat board has 2 ADV7513 chips on the same I2C bus, however the ADV751x driver only supports 1 chip as it tries to assign the packet/ EDID/CEC memory I2C devices to the fixed I2C addresses. Assign these I2C addresses at the fixed offsets (derived from the programming guide) from the main register map address instead... Signed-off-by: Sergei Shtylyov --- The patch is against David Airlie's 'linux.git' repo's 'drm-next' branch. Changes in version 2: - added support for ADV7533 CEC alternate address. drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 12 ++++++------ drivers/gpu/drm/bridge/adv7511/adv7533.c | 5 ++--- 2 files changed, 8 insertions(+), 9 deletions(-) Index: linux/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c =================================================================== --- linux.orig/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ linux/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -922,15 +922,13 @@ static int adv7511_parse_dt(struct devic return 0; } -static const int edid_i2c_addr = 0x7e; -static const int packet_i2c_addr = 0x70; -static const int cec_i2c_addr = 0x78; - static int adv7511_probe(struct i2c_client *i2c, const struct i2c_device_id *id) { struct adv7511_link_config link_config; struct adv7511 *adv7511; struct device *dev = &i2c->dev; + unsigned int main_i2c_addr = i2c->addr << 1; + unsigned int edid_i2c_addr = main_i2c_addr + 4; unsigned int val; int ret; @@ -991,8 +989,10 @@ static int adv7511_probe(struct i2c_clie regmap_write(adv7511->regmap, ADV7511_REG_EDID_I2C_ADDR, edid_i2c_addr); regmap_write(adv7511->regmap, ADV7511_REG_PACKET_I2C_ADDR, - packet_i2c_addr); - regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR, cec_i2c_addr); + main_i2c_addr - 0xa); + regmap_write(adv7511->regmap, ADV7511_REG_CEC_I2C_ADDR, + main_i2c_addr - 2); + adv7511_packet_disable(adv7511, 0xffff); adv7511->i2c_main = i2c; Index: linux/drivers/gpu/drm/bridge/adv7511/adv7533.c =================================================================== --- linux.orig/drivers/gpu/drm/bridge/adv7511/adv7533.c +++ linux/drivers/gpu/drm/bridge/adv7511/adv7533.c @@ -149,13 +149,12 @@ void adv7533_uninit_cec(struct adv7511 * i2c_unregister_device(adv->i2c_cec); } -static const int cec_i2c_addr = 0x78; - int adv7533_init_cec(struct adv7511 *adv) { int ret; - adv->i2c_cec = i2c_new_dummy(adv->i2c_main->adapter, cec_i2c_addr >> 1); + adv->i2c_cec = i2c_new_dummy(adv->i2c_main->adapter, + adv->i2c_main->addr - 1); if (!adv->i2c_cec) return -ENOMEM;