Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp4017674pxa; Sun, 9 Aug 2020 20:44:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOoa4dX9JAb6taAvRFTcuU+pm3HEy0AvlYvpZeQkLgxYr4nr4Xa2uP1975yeGzfrEwX+dh X-Received: by 2002:a17:906:7e0a:: with SMTP id e10mr19478824ejr.312.1597031065128; Sun, 09 Aug 2020 20:44:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597031065; cv=none; d=google.com; s=arc-20160816; b=Ivu0bykpmtfqTaPNkO9JZW1Aj1vF8nEvZUnIfIyXhygkfuJIdARWQ9WeliV/GZU5Mm yl0Tn1TSosjagsHXJClWbzVDuzRZEHE8SAJTo5RGiKU42xVgPE1W7AAN6MRDst2BxAU8 /+FYvhyjM/lKHYyreGQ3pjkv5Kf4SZ8d4pJcvVjfVmb2E+MustoZBaUhEoQeYgVR8/i3 AqKyPoW2ndjes2zEbfGwDucLpfor83GtuDzj70of1TzhGoQirK0zD6P4DcyrM76leVBI RYn7mN40FUraypGN1mFBQIaWl0WVtTgshEjtISc1at4FOKqffNxwHHQ53vkukqT0SUIM NU9A== 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:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=Vh1My8W43NNHp3RUa3ErfWdZWmQdB1+v484OBu3QyUg=; b=cvv+UwQ/qwIN4/MqpH14+TeRNE5ZX9vLxUrp8NIJ0331gyuZI7amQEKAxxgdN02HCR Kubb/rdZoeEiYKyZ52ksz6NCJfgquE4GtEzWsTEPWDJ6H1nofLp40weo394Q2ykY0cSs gY3t6LntLgO+qjHy2AGijFmkfOWoATJlOT/4ueBAftm6aVvSXf+ei3hyhtMo9CWT8wtR awE8yU8ozF7flEoLzMoD4YQNIuK/0GM2kF9uYYolzg3cpq+2JeQsTY0hSMC/+devoLG1 hiC4gbaZ661Y8M0Z0f8o5bOwdzoZ1pHhlgAuvaPmgD3oqe91OLXqRkEOhvbDrzh7q+G8 KkxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=QNBdGsWh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s16si10379816ejm.36.2020.08.09.20.44.01; Sun, 09 Aug 2020 20:44:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=QNBdGsWh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726389AbgHJDn3 (ORCPT + 99 others); Sun, 9 Aug 2020 23:43:29 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:19151 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726335AbgHJDn2 (ORCPT ); Sun, 9 Aug 2020 23:43:28 -0400 X-UUID: 9e031a993e494a529ad4372676f76a6a-20200810 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=Vh1My8W43NNHp3RUa3ErfWdZWmQdB1+v484OBu3QyUg=; b=QNBdGsWhsmUUTZnFCAztrjREo1sOxWEevV7GdoNNgjqUxDgAIcAM0KaHpNS01LoqK9QfUodMD2UfkihEZrRGcVctHs29X2ONbb2LIDAsGdMEDekF5e8/K55DrPFxsHH/FNsgDoFujcjnZmnVnJC9Daqp9kWGDbKiNdJD3RKRS1A=; X-UUID: 9e031a993e494a529ad4372676f76a6a-20200810 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 530900191; Mon, 10 Aug 2020 11:43:15 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 10 Aug 2020 11:43:13 +0800 Received: from [172.21.77.33] (172.21.77.33) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 10 Aug 2020 11:43:13 +0800 Message-ID: <1597030994.7823.5.camel@mtkswgap22> Subject: Re: [PATCH v5 2/2] soc: mediatek: add mt6779 devapc driver From: Neal Liu To: Chun-Kuang Hu CC: Neal Liu , Rob Herring , Matthias Brugger , , wsd_upstream , lkml , "moderated list:ARM/Mediatek SoC support" , Linux ARM Date: Mon, 10 Aug 2020 11:43:14 +0800 In-Reply-To: References: <1596766948-29767-1-git-send-email-neal.liu@mediatek.com> <1596766948-29767-3-git-send-email-neal.liu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 MIME-Version: 1.0 X-MTK: N Content-Transfer-Encoding: base64 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SGkgQ2h1bi1LdWFuZywNCg0KT24gRnJpLCAyMDIwLTA4LTA3IGF0IDIzOjUyICswODAwLCBDaHVu LUt1YW5nIEh1IHdyb3RlOg0KPiBIaSwgTmVhbDoNCj4gDQo+IE5lYWwgTGl1IDxuZWFsLmx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