Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp269374pxb; Mon, 16 Aug 2021 05:13:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwPLsw2zyn57UX22++9o8dXCv+KD4dsGCDVqd0SNnKpRUqd6KvdzoglqHK15r/HksvOzyUC X-Received: by 2002:a92:440f:: with SMTP id r15mr10972930ila.51.1629116008771; Mon, 16 Aug 2021 05:13:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629116008; cv=none; d=google.com; s=arc-20160816; b=rHOpwCKTTBZrU2szPRyFDrADUbm9UXDLsMoxae5XimKCnvOwSFYkQ0g1J4YCEnS0lw L4g7OqvzSbWB2TfeVQNxHPzUkCR9T1lRTmaEUbjA5ckXM4lRMfngLPGzDRB3yIIpRDxD jIfjXq0HiGwICRvzVvAeAj//WiUr849YkoRrZ/Kf/3TjT/GszdXEdd/oLu3KkiDZETrF KCxYa8oKryxyzL/HVj6vN4QNOGr2uxM1STO8sFvYJGHPyXFtP0zbg1pJlvNuWQJ0PZ88 e+K3BjuEFmnoRE9550QbVv3M0+Zf1kBHcR8jEdgeumECdSRV3874F9ZzWzMoT952Za36 5i+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=kkysPn/5aJXvWrgV2Um/G5eKzXBq7Ohp9jMuEy/5iYQ=; b=kV9d1fhc11YIk8TKEdjji43QR2bDC1VcjKUJkaVKs+5INGwUpSwKQ1l5UYhOMO/3QH OpkGCFYMmciP6E3uQjCfHmklKqMecu3TRF0A+s2xJuSzWGo2EVGXV5YGF9FKYeQtefpH 1nlKTYRQocRHu+M2lVi0KpKEKASZ5iS37aYNtBkFYb/05UHsI78S/HiHICy//JXZ5NeK woL1mTqIek0OYre7qGpWlpTrDa0Dbgm0JC0XuNPBfaNwGdMMP/2jZHoaEIzTksnZct2A j500nhodCvRgs1gB6XjTPWtFxEQcnSeo29Eb8wuxyPm05qBXSF8sOcXFsDAfBTZHNlf2 loxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=Fjqo8WY5; 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 v13si10184546ilj.65.2021.08.16.05.13.15; Mon, 16 Aug 2021 05:13:28 -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=Fjqo8WY5; 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 S233062AbhHPMMN (ORCPT + 99 others); Mon, 16 Aug 2021 08:12:13 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:51156 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229836AbhHPMMM (ORCPT ); Mon, 16 Aug 2021 08:12:12 -0400 X-UUID: 5e47368bc4da423b8b293617b2f75340-20210816 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=kkysPn/5aJXvWrgV2Um/G5eKzXBq7Ohp9jMuEy/5iYQ=; b=Fjqo8WY5cgB2jePVO0i542gfEym99HrP0JrThjvjeUrpf1HG5tX6ExGpoS0qX4jaY0eodyMVtT+2MOPhMmEKwfEWvwsuh+2Js21ZqOfbKWqLNLza2rUKXLMVhAqEsWmTrcBzavSfo2uRFgw88Qw9pIDH3Y1JGycIdN6Y7MR91FA=; X-UUID: 5e47368bc4da423b8b293617b2f75340-20210816 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 146643191; Mon, 16 Aug 2021 20:11:39 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 16 Aug 2021 20:11:38 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Mon, 16 Aug 2021 20:11:38 +0800 Message-ID: <1629115898.29907.3.camel@mtksdaap41> Subject: Re: [PATCH v10 3/5] spmi: mediatek: Add support for MT6873/8192 From: Hsin-hsiung Wang To: Stephen Boyd CC: Matthias Brugger , Rob Herring , , , , , , Date: Mon, 16 Aug 2021 20:11:38 +0800 In-Reply-To: <162853170949.1975443.12492156194100139076@swboyd.mtv.corp.google.com> References: <1627972461-2627-1-git-send-email-hsin-hsiung.wang@mediatek.com> <1627972461-2627-4-git-send-email-hsin-hsiung.wang@mediatek.com> <162853170949.1975443.12492156194100139076@swboyd.mtv.corp.google.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 X-MTK: N Content-Transfer-Encoding: base64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org SGksDQoNCk9uIE1vbiwgMjAyMS0wOC0wOSBhdCAxMDo1NSAtMDcwMCwgU3RlcGhlbiBCb3lkIHdy b3RlOg0KPiBRdW90aW5nIEhzaW4tSHNpdW5nIFdhbmcgKD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AgICAgICAgICAgb3BjID0gUE1JRl9DTURfUkVHOw0K PiA+ICsgICAgICAgZWxzZSBpZiAoKG9wYyA+PSAweDIwICYmIG9wYyA8PSAweDJmKSB8fCAob3Bj ID49IDB4MzggJiYgb3BjIDw9IDB4M2YpKQ0KPiA+ICsgICAgICAgICAgICAgICBvcGMgPSBQTUlG X0NNRF9FWFRfUkVHX0xPTkc7DQo+ID4gKyAgICAgICBlbHNlDQo+ID4gKyAgICAgICAgICAgICAg IHJldHVybiAtRUlOVkFMOw0KPiA+ICsNCj4gPiArICAgICAgIC8qIFdhaXQgZm9yIFNvZnR3YXJl IEludGVyZmFjZSBGU00gc3RhdGUgdG8gYmUgSURMRS4gKi8NCj4gPiArICAgICAgIGluZl9yZWcg PSAmYXJiLT5jaGFuOw0KPiA+ICsgICAgICAgcmV0ID0gcmVhZGxfcG9sbF90aW1lb3V0X2F0b21p YyhhcmItPmJhc2UgKyBhcmItPmRhdGEtPnJlZ3NbaW5mX3JlZy0+Y2hfc3RhXSwNCj4gPiArICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgZGF0YSwgR0VUX1NXSU5GKGRhdGEp ID09IFNXSU5GX0lETEUsDQo+ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgIFBNSUZfREVMQVlfVVMsIFBNSUZfVElNRU9VVF9VUyk7DQo+ID4gKyAgICAgICBpZiAocmV0 IDwgMCkgew0KPiA+ICsgICAgICAgICAgICAgICAvKiBzZXQgY2hhbm5lbCByZWFkeSBpZiB0aGUg ZGF0YSBoYXMgdHJhbnNmZXJyZWQgKi8NCj4gPiArICAgICAgICAgICAgICAgaWYgKHBtaWZfaXNf ZnNtX3ZsZGNscihhcmIpKQ0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgIHBtaWZfd3JpdGVs KGFyYiwgMSwgaW5mX3JlZy0+Y2hfcmR5KTsNCj4gPiArICAgICAgICAgICAgICAgZGV2X2Vycigm Y3RybC0+ZG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AgcmV0dXJuIC1FSU5WQUw7DQo+ID4gKyAgICAgICB9DQo+ID4gKw0KPiA+ICsg ICAgICAgLyogQ2hlY2sgdGhlIG9wY29kZSAqLw0KPiA+ICsgICAgICAgaWYgKG9wYyA+PSAweDQw ICYmIG9wYyA8PSAweDVGKQ0KPiA+ICsgICAgICAgICAgICAgICBvcGMgPSBQTUlGX0NNRF9SRUc7 DQo+ID4gKyAgICAgICBlbHNlIGlmICgob3BjIDw9IDB4RikgfHwgKG9wYyA+PSAweDMwICYmIG9w YyA8PSAweDM3KSkNCj4gPiArICAgICAgICAgICAgICAgb3BjID0gUE1JRl9DTURfRVhUX1JFR19M T05HOw0KPiA+ICsgICAgICAgZWxzZSBpZiAob3BjID49IDB4ODApDQo+ID4gKyAgICAgICAgICAg ICAgIG9wYyA9IFBNSUZfQ01EX1JFR18wOw0KPiA+ICsgICAgICAgZWxzZQ0KPiA+ICsgICAgICAg ICAgICAgICByZXR1cm4gLUVJTlZBTDsNCj4gPiArDQo+ID4gKyAgICAgICAvKiBXYWl0IGZvciBT b2Z0d2FyZSBJbnRlcmZhY2UgRlNNIHN0YXRlIHRvIGJlIElETEUuICovDQo+ID4gKyAgICAgICBp bmZfcmVnID0gJmFyYi0+Y2hhbjsNCj4gPiArICAgICAgIHJldCA9IHJlYWRsX3BvbGxfdGltZW91 dF9hdG9taWMoYXJiLT5iYXNlICsgYXJiLT5kYXRhLT5yZWdzW2luZl9yZWctPmNoX3N0YV0sDQo+ ID4gKyAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGRhdGEsIEdFVF9TV0lO RihkYXRhKSA9PSBTV0lORl9JRExFLA0KPiA+ICsgICAgICAgICAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICBQTUlGX0RFTEFZX1VTLCBQTUlGX1RJTUVPVVRfVVMpOw0KPiA+ICsgICAgICAg aWYgKHJldCA8IDApIHsNCj4gPiArICAgICAgICAgICAgICAgLyogc2V0IGNoYW5uZWwgcmVhZH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