Received: by 2002:a25:ca44:0:0:0:0:0 with SMTP id a65csp2384031ybg; Thu, 30 Jul 2020 19:45:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNGUbVKc5AvwaHbWv9ZtE8/IIzXB53omXDkePn1Ib1t1j6y2WrP5s5sJu7jpQpfhjooDSS X-Received: by 2002:a17:906:ecf7:: with SMTP id qt23mr2056212ejb.314.1596163542569; Thu, 30 Jul 2020 19:45:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596163542; cv=none; d=google.com; s=arc-20160816; b=emGTgV+sbaH3Q0BgXfJQMC/8ujloheB6ZaiaYcDXqox5MwPi8aRXs5uK3CHDWjj1Ia 8or2zMj7KizJdSZOv3rJOHJYycSPgga0VjOrevZMuEWbIfF7ELpQO39gFWG+jVuKEqGX IYtiaj3qKBh9iWn3FSwBk6muY5sv9427EHgsZRBbExE7KN9A7C1sWTf2Sp9hGKFusFzs /r3XpfKWuglKQp59d9CT4izo5h58UgjkFDNDXaH2oSn9riGYUh+JWYbQMc13TvnD/Od3 o7GumaRrcBZjVT/TomC7C/Vp18X9PaFMRwZpzJsIiZiseOS5R+TRuZgTyHrIqtZi7PfH qQXQ== 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=JYWucvu8fAAG2ORtxlgiGm4dserLunZm7uDjVXQdg8Q=; b=cHC+NLiolm3yrZpTevwfR4goMpNTisfNXmiUce2LV7Cv3N0LbveRs8NH8bkxxgOfzh ArQdC+gXyA07R4QUt5gO9SGWPx8sinZz/6gVmMc4ZmZKEcoHj9dAi8HqJOZwD2gdx7TR cbOCyUwSMwpANecIBAeyzm0HrOq1f5jv25ZO97cU+7/RPcmbUzAKCIyRx6Wc00ytNULv LhPiA6e14qlSbRnb4GgRXATqHBU5EUsyPkWMrxK2bwmlFy/il1hVzXgeUz6GKUhWrPGD UI3N/UyzS9akNUlWSygeFll5jA+Wl4lQ1Q6dvwy6oK8Kau0fr1znKmk5BKzM0nANk/oK frhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=onHD0cfU; 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 y17si4113407eju.316.2020.07.30.19.45.18; Thu, 30 Jul 2020 19:45:42 -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=onHD0cfU; 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 S1731172AbgGaCou (ORCPT + 99 others); Thu, 30 Jul 2020 22:44:50 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:2081 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731124AbgGaCou (ORCPT ); Thu, 30 Jul 2020 22:44:50 -0400 X-UUID: 5c99840599594c54b6a6bd6ec2031617-20200731 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=JYWucvu8fAAG2ORtxlgiGm4dserLunZm7uDjVXQdg8Q=; b=onHD0cfUhYcka1Hxvg4AbQIQ6DA2b6vej5ys6A+mUBUOsFQnm5RaA44wbw3M7LEVre1JqEgM2/aNQlaAu4tGw8WKcjbUoOSelpEkDSeuCNFV7UXll5aZNOk5J4PVdKnVHoBR0XgM3jhilU5+YN9uNcvXQLtyPEproRhtY/Fux7g=; X-UUID: 5c99840599594c54b6a6bd6ec2031617-20200731 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 209702804; Fri, 31 Jul 2020 10:44:43 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 31 Jul 2020 10:44:36 +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; Fri, 31 Jul 2020 10:44:38 +0800 Message-ID: <1596163478.3932.17.camel@mtkswgap22> Subject: Re: [PATCH v4 2/2] soc: mediatek: add mtk-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: Fri, 31 Jul 2020 10:44:38 +0800 In-Reply-To: References: <1596010690-13178-1-git-send-email-neal.liu@mediatek.com> <1596010690-13178-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-TM-SNTS-SMTP: 0C9F9D3942F214AAEECCF9AB13F4C8C7895848F0DED59C9523A2AC9BBBB6A6B72000:8 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 SGkgQ2h1bi1LdWFuZywNCg0KDQpPbiBUaHUsIDIwMjAtMDctMzAgYXQgMDA6MzggKzA4MDAsIENo dW4tS3Vh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KSwgR0ZQX0tFUk5FTCk7DQo+ID4gKyAgICAgICBpZiAoIWN0eCkNCj4gPiArICAgICAg ICAgICAgICAgcmV0dXJuIC1FTk9NRU07DQo+ID4gKw0KPiA+ICsgICAgICAgY3R4ID0gKHN0cnVj dCBtdGtfZGV2YXBjX2NvbnRleHQgKilvZl9kZXZpY2VfZ2V0X21hdGNoX2RhdGEoJnBkZXYtPmRl dik7DQo+ID4gKyAgICAgICBjdHgtPmRldiA9ICZwZGV2LT5kZXY7DQo+ID4gKw0KPiA+ICsgICAg ICAgY3R4LT52aW9faW5mbyA9IGRldm1fa3phbGxvYygmcGRldi0+ZGV2LA0KPiA+ICsgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICBzaXplb2Yoc3RydWN0IG10a19kZXZhcGNfdmlv X2luZm8pLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBHRlBfS0VS TkVMKTsNCj4gPiArICAgICAgIGlmICghY3R4LT52aW9faW5mbykNCj4gPiArICAgICAgICAgICAg ICAgcmV0dXJuIC1FTk9NRU07DQo+ID4gKw0KPiA+ICsgICAgICAgY3R4LT5kZXZhcGNfcGRfYmFz ZSA9IG9mX2lvbWFwKG5vZGUsIDApOw0KPiA+ICsgICAgICAgaWYgKCFjdHgtPmRldmFwY19wZF9i YXNlKQ0KPiA+ICsgICAgICAgICAgICAgICByZXR1cm4gLUVJTlZBTDsNCj4gPiArDQo+ID4gKyAg ICAgICBkZXZhcGNfaXJxID0gaXJxX29mX3BhcnNlX2FuZF9tYXAobm9kZSwgMCk7DQo+ID4gKyAg ICAgICBpZiAoIWRldmFwY19pcnEpDQo+ID4gKyAgICAgICAgICAgICAgIHJldHVybiAtRUlOVkFM Ow0KPiA+ICsNCj4gPiArICAgICAgIGRldmFwY19pbmZyYV9jbGsgPSBkZXZtX2Nsa19nZXQoJnBk ZXYtPmRldiwgImRldmFwYy1pbmZyYS1jbG9jayIpOw0KPiA+ICsgICAgICAgaWYg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