Received: by 2002:a25:5b86:0:0:0:0:0 with SMTP id p128csp1565968ybb; Fri, 29 Mar 2019 07:04:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgxh/CqXeNZ6jzHKvTv3Cn9kbNCR0KWlIA8VTFcxBbxNHEqVrCpvPyTFQ7nSLT9Rv7l5cT X-Received: by 2002:aa7:85d9:: with SMTP id z25mr36970153pfn.31.1553868277464; Fri, 29 Mar 2019 07:04:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553868277; cv=none; d=google.com; s=arc-20160816; b=IzcVZTYPJ9mmud+SOkeSifT5sPc+qrCATqIMMsWRkmUb340TiL4/IDnyhfF8CAn2Iy 8G9Vl52JGMg7Hb1S5jnLi/F5g3bCjR6zHdyNit274jf8/TaTdmGithcw7L7AAApaiUxH LWBoQTD302xTFvP8fRr4InrF/U/bcLmRY9oeaezpK7xtZXWxQKbBMTGXMMH21hPkYo9m fQi+QlKuAo1+wcB2xR6miO0cJHOCRyGWjCdl4SCrN2RIFv0+NC4ssPEBcJaZAynELQJR hhoXD3DZeprhwTK0yeurc/yFuEVVBP3S0g2/bpoGEQcGrMG28EN3KeHtUxSaRKZQQaOr 7nvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=AhLJk/MDv02Fs/iD/1MUcrsjReWxwZYHZH/Zgi7uZ+M=; b=bKL+1ULcCgH4WvnzYd9m9sPeQWmaVxpf0UbJwTTtjBQjcQypGSzb8GK5/InjIYwe5E yg96RFkkdGhBhQqRLA0dbOkL9aS0wfGADEsjiRqAwZEd6JWwbsKyaTk4L3fXB4DdKbLH qx4j2YZRnTKusm3n9YI0H4Cve3yVurc1zJVn9M6rX5hPNuPhguEzOqT/9WcDOv/muieA PcJV6HfVdv6QRaBeq7NBj8byj5A+YkY45p315I2vHrsHyIBzBl3a4Cj5mQo5ho+v7dWF IpIsbYflOL5y7ZP3Po+OGjYuz8dq4uEIo3UQhJq/C5RN17FV6Y+BsJlCdbZGgenQEYYr Rh1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="g3J+AA/o"; 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=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v7si1950306plp.191.2019.03.29.07.04.21; Fri, 29 Mar 2019 07:04:37 -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=@linaro.org header.s=google header.b="g3J+AA/o"; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729035AbfC2ODS (ORCPT + 99 others); Fri, 29 Mar 2019 10:03:18 -0400 Received: from mail-qt1-f193.google.com ([209.85.160.193]:44221 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728764AbfC2ODR (ORCPT ); Fri, 29 Mar 2019 10:03:17 -0400 Received: by mail-qt1-f193.google.com with SMTP id w5so2379454qtb.11 for ; Fri, 29 Mar 2019 07:03:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=AhLJk/MDv02Fs/iD/1MUcrsjReWxwZYHZH/Zgi7uZ+M=; b=g3J+AA/ovBXpHAoMz9u1W2Qu6Qxe+WIq5+YHKJEpuPVkVNs1+gGp2TdotSdSrMpA5z a2Z2FWH7kasQw05f03xbuTcAuZFxcZ0seTzIj5Va3EakF+U2oUr45xOqG67kQZMGZdo0 s787xL0VcTcnTrFNIv+gjrmvf/+LaLY8WmaYGtRezk869oTql+emSRRa2K5+z5qxCYIR KY1rvc7HipxOu1EwxeNzYXIU529wSsr/36usVQBk9eEMuFAwBU1+04HoOSYZE2QIPObC YsAFIQ4CTOKAVaODfZszfLG0CZEa7UcM7gy6BWnQ3CvtvnXAHGiaLln+AG9R+7zVl/sQ fwZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=AhLJk/MDv02Fs/iD/1MUcrsjReWxwZYHZH/Zgi7uZ+M=; b=Og1T/OLyd/U5Fm/FtIkm8+uENfDIKI0417lpatr80JQ2eR8c3ebO2QuZZGJ/tPMBp9 Ne5jJvS0Owfl94+dxtfYyp1j0q9G41uWz2e2qsPV/6T0FOQoWpmDpWlFjLaFWFxLshh4 mYqQLIAKuQmQ5lyiY35Zxce3Zg+P84jD6ROILlWk9STwthPXUGFAi42+nlMvYOxdstZ3 G8M9XFbUSNZ3hRjuFokVzaYT4ShNJEzq5+ThbZTYQJLj/MD1tX20+y/eqHX/P2CxTbSz RjhHocKVKZvbRV9e6Kh66YgYGOuvmymIkd50F3ycG1YjAMXdO8nueh1U4KlLhtyitYi5 nHVQ== X-Gm-Message-State: APjAAAW5HbY/OBBOEb6syLTp3iTvRnMyUbUpMnWJnQ012+6CpSUA2LYn +SC4SrbzVi/9v17FIeKHlVtBofiixZweyMaly5E9g/6b X-Received: by 2002:a0c:b92c:: with SMTP id u44mr39562381qvf.222.1553868196575; Fri, 29 Mar 2019 07:03:16 -0700 (PDT) MIME-Version: 1.0 References: <1553863182-6544-1-git-send-email-yannick.fertre@st.com> In-Reply-To: <1553863182-6544-1-git-send-email-yannick.fertre@st.com> From: Benjamin Gaignard Date: Fri, 29 Mar 2019 15:03:05 +0100 Message-ID: Subject: Re: [PATCH] media: platform: stm32: wait end of transmission To: =?UTF-8?Q?Yannick_Fertr=C3=A9?= Cc: Mauro Carvalho Chehab , Maxime Coquelin , Alexandre Torgue , linux-media@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Linux ARM , Linux Kernel Mailing List , Benjamin Gaignard , Philippe Cornu Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le ven. 29 mars 2019 =C3=A0 13:40, Yannick Fertr=C3=A9 a =C3=A9crit : > > It is mandatory to write CEC_CFGR only when CECEN=3D0. To protect > transmission, a check have been added to delayed logical address > modification. This patch is necessary tp pass all tests of compliance. Reviewed-by: Benjamin Gaignard > > Signed-off-by: Yannick Fertr=C3=A9 > --- > drivers/media/platform/stm32/stm32-cec.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/media/platform/stm32/stm32-cec.c b/drivers/media/pla= tform/stm32/stm32-cec.c > index 7c496bc..8a86b2c 100644 > --- a/drivers/media/platform/stm32/stm32-cec.c > +++ b/drivers/media/platform/stm32/stm32-cec.c > @@ -56,6 +56,13 @@ > #define ALL_TX_IT (TXEND | TXBR | TXACKE | TXERR | TXUDR | ARBLST) > #define ALL_RX_IT (RXEND | RXBR | RXACKE | RXOVR) > > +/* > + * 400 ms is the time it takes for one 16 byte message to be > + * transferred and 5 is the maximum number of retries. Add > + * another 100 ms as a margin. > + */ > +#define CEC_XFER_TIMEOUT_MS (5 * 400 + 100) > + > struct stm32_cec { > struct cec_adapter *adap; > struct device *dev; > @@ -188,7 +195,11 @@ static int stm32_cec_adap_log_addr(struct cec_adapte= r *adap, u8 logical_addr) > { > struct stm32_cec *cec =3D adap->priv; > u32 oar =3D (1 << logical_addr) << 16; > + u32 val; > > + /* Poll every 100=C2=B5s the register CEC_CR to wait end of trans= mission */ > + regmap_read_poll_timeout(cec->regmap, CEC_CR, val, !(val & TXSOM)= , > + 100, CEC_XFER_TIMEOUT_MS * 1000); > regmap_update_bits(cec->regmap, CEC_CR, CECEN, 0); > > if (logical_addr =3D=3D CEC_LOG_ADDR_INVALID) > -- > 2.7.4 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel