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: 9315117 X-Patchwork-Delegate: geert@linux-m68k.org 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 B1A5560760 for ; Mon, 5 Sep 2016 19:43:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A460828544 for ; Mon, 5 Sep 2016 19:43:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 99014288E1; Mon, 5 Sep 2016 19:43:36 +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=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F1A8A28544 for ; Mon, 5 Sep 2016 19:43:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935431AbcIETnZ (ORCPT ); Mon, 5 Sep 2016 15:43:25 -0400 Received: from mail-lf0-f52.google.com ([209.85.215.52]:34845 "EHLO mail-lf0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933623AbcIETnW (ORCPT ); Mon, 5 Sep 2016 15:43:22 -0400 Received: by mail-lf0-f52.google.com with SMTP id l131so38748944lfl.2 for ; Mon, 05 Sep 2016 12:43:21 -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=KqJ+UG7fuR37/sXUqlm5k+ZEEMsN+mO/2FqlNAgiojMbFu7WBPa8mFiRvXfdm/I+At iBT8621i7qz+XZQmxR7on5BtLXj+33CLUJlt4PUK7PMx0fNF9qqic0XS5EMuCeXDzFW8 cVt/fBITtC3Q2IhseosEHH+MChu7Srwefcfk/WbL5n/PY1lrDhP1DCBVXc3nqaJzxG9F nbaYZLFMpM5kfmDvvMjwjtZI5FaHMGwr8dc5gMH+v0Ln3fyvUoqMp3n99HJ/xj6wPi8G Rs5eIRYK1JfrskBTKfcmTmgpyxIDT+jeHB1icVp17DtlxjBKzUW7ndOOEnkfMQWOWqi5 SrhQ== X-Gm-Message-State: AE9vXwP1YRdV0byqYpS8KJHe4TceyZqjYjgA55inci/IwYY+MndqhP1KkVP50RTaO36SOA== 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 Cc: linux-renesas-soc@vger.kernel.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 Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org 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;