Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8898488ybi; Thu, 6 Jun 2019 23:14:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqxUrM44ecUtkyht1Ix9N/DgJcSeZ3bWYxaWxNGlXpODBh9zAwP2XeEwsVzvnwYiFkllp2cl X-Received: by 2002:a17:902:347:: with SMTP id 65mr55165536pld.232.1559888099030; Thu, 06 Jun 2019 23:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559888099; cv=none; d=google.com; s=arc-20160816; b=Y5dC1XniMr2nuN/l+WI6wJPVo3cKLPBbRxRbAM1TIrlCmInwe5eZRB/WrRzWbJSSAn CSYnKraRuJHzRfwB4XsOm3l3FJWDRrpMNmCIMG04y3oBzB00OSMuokE6VOV3c6QcjNR7 0o9cevynelDAcxEQJnbUzZTdvTg14JaegczZPC013lo3N3rdOuUY8mcnKv7Pd8T9Gs0F wx3WxTwaqWu3oM+jolOLPWy73KwhdpO5WGrG+x36ouLpa1UTUup8kK2IzuPNckv03ffn x+rFVqs/KAyyM1LD+x10OEg90p+104mgIkwOenpqGMFWitNv9ufuFJvmW6Ietf7xgW6f BuEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:cc:to:subject:dkim-signature:dkim-filter; bh=rY1LsFvS8wHdYvQgg3J28EeOngDObvqh8vabpmaHDEE=; b=GJxudUshei6eraM0opM/YphyMdhVago0tqPw3Kaf1V5oBTz7EF5yFPxFVTLBe2YWE+ jbPwpOB5wVFSoBYgmzlKIMM8FWyVBzv8iNwe54J36K+5U+s86xZE5kc0D5Qbe3L+v7TY Dq1v5do0/pSXXXOReqdwXuBLyq/Ia8fWBpRtualZg8LNGP4AGbRMc3KxeYIvEXFdlr8j Kt25/5FIjctIKt6VB1iZ6AEBzx1rpIntKyQegsb/GA1jmvEgJUNPHuD7ENRn6mC+ukLX 2RjVHkilRf5SuMSBJIJenIHoAn3/fgSmAVLon/YRDVyPMDEJbAc8o42KyNLmGg+7kFXR Js/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BhKxYUCX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si1027158pls.109.2019.06.06.23.14.42; Thu, 06 Jun 2019 23:14:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=BhKxYUCX; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726875AbfFGGNg (ORCPT + 99 others); Fri, 7 Jun 2019 02:13:36 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:54382 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbfFGGNg (ORCPT ); Fri, 7 Jun 2019 02:13:36 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20190607061334euoutp022faadaf2edfc4e39476ac7d01de5876c~l1eJ3vW6d2914529145euoutp02X for ; Fri, 7 Jun 2019 06:13:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20190607061334euoutp022faadaf2edfc4e39476ac7d01de5876c~l1eJ3vW6d2914529145euoutp02X DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1559888014; bh=rY1LsFvS8wHdYvQgg3J28EeOngDObvqh8vabpmaHDEE=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=BhKxYUCXikFGilgRAlYQ4xx+flCzIgGh+qmpVc+gNLOv18/9frJUonl1YfjZ37eg6 2ea7oOxJJ7hWZBA4vywc3DI/5dZLCijVAyDSl6+ephYUGSfjmgXuVmGc4dzCE7Duk0 1aM32DkiBqm/8/tdaX3Yulvar4dz5RKQUk6TgJSw= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20190607061333eucas1p272a5a2820d275b3184631fd6a01e3ca2~l1eJJ_4Md0641406414eucas1p2U; Fri, 7 Jun 2019 06:13:33 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 36.2D.04377.D800AFC5; Fri, 7 Jun 2019 07:13:33 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20190607061332eucas1p2c4290d1bbd0970a34db5114ede6bb7ce~l1eIYI75b0641406414eucas1p2T; Fri, 7 Jun 2019 06:13:32 +0000 (GMT) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20190607061332eusmtrp1f1ffcc682274f1ebc98b9fb1f1e2384a~l1eIIdZ1H0381503815eusmtrp1k; Fri, 7 Jun 2019 06:13:32 +0000 (GMT) X-AuditID: cbfec7f4-12dff70000001119-83-5cfa008da2fb Received: from eusmtip1.samsung.com ( [203.254.199.221]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id 37.D5.04140.C800AFC5; Fri, 7 Jun 2019 07:13:32 +0100 (BST) Received: from [106.120.51.74] (unknown [106.120.51.74]) by eusmtip1.samsung.com (KnoxPortal) with ESMTPA id 20190607061331eusmtip1638d4530bab6b44407d46d2f883ecdad~l1eHY7X1j3106031060eusmtip1j; Fri, 7 Jun 2019 06:13:31 +0000 (GMT) Subject: Re: [PATCH v4 10/15] drm/bridge: tc358767: Add support for address-only I2C transfers To: Andrey Smirnov , dri-devel@lists.freedesktop.org Cc: Laurent Pinchart , Tomi Valkeinen , Andrey Gusakov , Philipp Zabel , Cory Tusar , Chris Healy , Lucas Stach , linux-kernel@vger.kernel.org From: Andrzej Hajda Message-ID: <471cea60-0eb6-920d-bf2f-c34bc3a0b272@samsung.com> Date: Fri, 7 Jun 2019 08:13:24 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20190607044550.13361-11-andrew.smirnov@gmail.com> Content-Transfer-Encoding: 8bit Content-Language: en-US X-Brightmail-Tracker: H4sIAAAAAAAAA01Se0hTcRj1d1+7jibXaezLJGlJklCujLpimkHEKIIeBllSLr1Ma1uymzOL aEyx5QMzezkNhRQtRc3HzOUfupHTTDMrNPNFSdDDjErS0sx5lfzvfOec7/edAz8al7aRPnSC 7hyn16k0ckpMWNumn2/MdvsdrfiW5summsNYk91IslOvHATb2uzE2FeTExQ7evcNxl7NLRGx L22FFDs03E6w1UUDVIRYOXpzDlM2WYZEygJzPqkcyXRiypxZhdLZ34gpf9SuUXbf7MIO0MfE O+I4TYKB0weFx4jjczPbycQWON96v4o0omdeGcidBmYr5AwW4RlITEuZcgS/zR+QMPxEMFs5 RwrDDwSVtTNoaeVWxT2RC0uZMgQfSg4LpnEEpvwv8wJNezExYC1Z8HszB+C7qYlyeXCmE4Mr tre4S6CYDTBb94ZyYQkTDkNPrAs8wfhDl71mYXklcxRG2mpIweMJHfljhAu7MzsheyxnIQTO +EFqQwEuYBkMjBVhrmPADIvgc08jJaTeDRMlTxcbeMEnZ71IwL7QmZdFCPgyj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sQI8aYkVlalFuXHF5XmpBYf YjQFem4is5Rocj4wkeSVxBuaGppbWBqaG5sbm1koifN2CByMERJITyxJzU5NLUgtgulj4uCU amC0cr8fo3pltv1+/sm8i7gzLGI7mB8cmLSUN3q/kYaxQLZwv3zdya6DPAYdMzezfrvyarOG 8Zcm5ddRAtnp1/dnHee+t9y4mfnfK59ld2eZlzI9SLA9yq/y+PmjV/MFGSTef+s765nlkzp9 6nLN+pCb22XcdYyK8zxPmgdtO6Y8/9WK6DvvWQ4osRRnJBpqMRcVJwIAcivIAuwCAAA= X-CMS-MailID: 20190607061332eucas1p2c4290d1bbd0970a34db5114ede6bb7ce X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20190607044643epcas3p288c95d8f86c74056677b22b27ca2fe30 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20190607044643epcas3p288c95d8f86c74056677b22b27ca2fe30 References: <20190607044550.13361-1-andrew.smirnov@gmail.com> <20190607044550.13361-11-andrew.smirnov@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07.06.2019 06:45, Andrey Smirnov wrote: > Transfer size of zero means a request to do an address-only > transfer. Since the HW support this, we probably shouldn't be just > ignoring such requests. While at it allow DP_AUX_I2C_MOT flag to pass > through, since it is supported by the HW as well. > > Signed-off-by: Andrey Smirnov Reviewed-by: Andrzej Hajda  -- Regards Andrzej > Cc: Andrzej Hajda > Cc: Laurent Pinchart > Cc: Tomi Valkeinen > Cc: Andrey Gusakov > Cc: Philipp Zabel > Cc: Cory Tusar > Cc: Chris Healy > Cc: Lucas Stach > Cc: dri-devel@lists.freedesktop.org > Cc: linux-kernel@vger.kernel.org > --- > drivers/gpu/drm/bridge/tc358767.c | 30 +++++++++++++++++++++++------- > 1 file changed, 23 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358767.c b/drivers/gpu/drm/bridge/tc358767.c > index 7d0fbb12195b..4bb9b15e1324 100644 > --- a/drivers/gpu/drm/bridge/tc358767.c > +++ b/drivers/gpu/drm/bridge/tc358767.c > @@ -145,6 +145,8 @@ > > /* AUX channel */ > #define DP0_AUXCFG0 0x0660 > +#define DP0_AUXCFG0_BSIZE GENMASK(11, 8) > +#define DP0_AUXCFG0_ADDR_ONLY BIT(4) > #define DP0_AUXCFG1 0x0664 > #define AUX_RX_FILTER_EN BIT(16) > > @@ -327,6 +329,18 @@ static int tc_aux_read_data(struct tc_data *tc, void *data, size_t size) > return size; > } > > +static u32 tc_auxcfg0(struct drm_dp_aux_msg *msg, size_t size) > +{ > + u32 auxcfg0 = msg->request; > + > + if (size) > + auxcfg0 |= FIELD_PREP(DP0_AUXCFG0_BSIZE, size - 1); > + else > + auxcfg0 |= DP0_AUXCFG0_ADDR_ONLY; > + > + return auxcfg0; > +} > + > static ssize_t tc_aux_transfer(struct drm_dp_aux *aux, > struct drm_dp_aux_msg *msg) > { > @@ -336,9 +350,6 @@ static ssize_t tc_aux_transfer(struct drm_dp_aux *aux, > u32 auxstatus; > int ret; > > - if (size == 0) > - return 0; > - > ret = tc_aux_wait_busy(tc, 100); > if (ret) > return ret; > @@ -362,8 +373,7 @@ static ssize_t tc_aux_transfer(struct drm_dp_aux *aux, > if (ret) > return ret; > /* Start transfer */ > - ret = regmap_write(tc->regmap, DP0_AUXCFG0, > - ((size - 1) << 8) | request); > + ret = regmap_write(tc->regmap, DP0_AUXCFG0, tc_auxcfg0(msg, size)); > if (ret) > return ret; > > @@ -377,8 +387,14 @@ static ssize_t tc_aux_transfer(struct drm_dp_aux *aux, > > if (auxstatus & AUX_TIMEOUT) > return -ETIMEDOUT; > - > - size = FIELD_GET(AUX_BYTES, auxstatus); > + /* > + * For some reason address-only DP_AUX_I2C_WRITE (MOT), still > + * reports 1 byte transferred in its status. To deal we that > + * we ignore aux_bytes field if we know that this was an > + * address-only transfer > + */ > + if (size) > + size = FIELD_GET(AUX_BYTES, auxstatus); > msg->reply = FIELD_GET(AUX_STATUS, auxstatus); > > switch (request) {