Received: by 2002:ac0:aed5:0:0:0:0:0 with SMTP id t21csp1302567imb; Sat, 2 Mar 2019 09:55:39 -0800 (PST) X-Google-Smtp-Source: APXvYqzyG0kC+KBxM8VxMeH/XuNLfRvHah4KJ/NP4f+iO6Jg9W7rsFcKakau5IVhhkkrQR/Xt+1E X-Received: by 2002:a17:902:8f81:: with SMTP id z1mr12025577plo.265.1551549339202; Sat, 02 Mar 2019 09:55:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1551549339; cv=none; d=google.com; s=arc-20160816; b=UP6mM3BJrfbs4kRoxZjuYW9Z16QNVwkpdFl0fZVL4MajLsxqHfxZgusYee9a2wVu3M LzGkwiVcQAMr6tcw8saR4DCo0IbQk4gxajZ9pfpKLbyTWPnZgVrZXPUhVwKsk9qmRPiU KihadWawaB6AGIF6PDIYb5L9GmTnhq7EnHT4qmFkWPXF1Q+h2PkIejoZzzLzg5PfC/9s KNVB65A7mKZRwxRqPVUqqzmRB3jJmEOak7MdtUmgdxCMOa7MJ+EbpZQQu/P9wGYfHMTi jqnV/s5oluHY+9tNqHEhb40/Th3wYEkPFx3490j6IUtpRg8mVV/EUtE9GP1HK3dfSICE DgVQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=QoZmvt25tN9ZuDcdrsKANQ8LHFZmt8TtrC6MhCMlQHo=; b=lGRwgL0tMaJ1pl23rINfOOGMQBaKAPnZSKWTmw8P7aIxTktrmyJsYuEDSpQ+5f0mKv JslGIt5wj/0x9pbdoxQOl6yxKkB20+I0m+bkcp6lE1BFR4EjfaADrUeMi3qbHG7YXQFr SuhHACf/RozT/KwkO5CaFVeRu8Sqg9PKi7cGEuLBNHIzQ5IEqZj29pbUwan68vD6mJ6/ DlMwKSQBIccQFiKKb7n7Ad7VR+0CLeqbd9RcxtuKLH+oNaUcQsoZ6EpXk+B2Fi4/GYJv GfHYBTFMcx1cR7hDKkEDikVcTcghozsnc3rrfpqM+vTxzIfjKGmoui+JoTibZUAekEgt sBbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tomli.me header.s=1490979754 header.b=cOCwtQgt; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tomli.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o188si1044159pfb.66.2019.03.02.09.54.45; Sat, 02 Mar 2019 09:55:39 -0800 (PST) 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=@tomli.me header.s=1490979754 header.b=cOCwtQgt; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tomli.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726720AbfCBRxv (ORCPT + 99 others); Sat, 2 Mar 2019 12:53:51 -0500 Received: from tomli.me ([153.92.126.73]:41934 "EHLO tomli.me" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726295AbfCBRxu (ORCPT ); Sat, 2 Mar 2019 12:53:50 -0500 Received: from tomli.me (localhost [127.0.0.1]) by tomli.me (OpenSMTPD) with ESMTP id 4f1a9d35; Sat, 2 Mar 2019 17:53:47 +0000 (UTC) X-HELO: localhost.lan Authentication-Results: tomli.me; auth=pass (login) smtp.auth=tomli Received: from Unknown (HELO localhost.lan) (2402:f000:1:1501:200:5efe:3d30:3659) by tomli.me (qpsmtpd/0.95) with ESMTPSA (DHE-RSA-CHACHA20-POLY1305 encrypted); Sat, 02 Mar 2019 17:53:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tomli.me; h=from:to:cc:subject:date:message-id:mime-version:content-transfer-encoding; s=1490979754; bh=Iu77gxni0hLs6Vm42KIrRqfu7CGwYdDyYrNUfOrmUHk=; b=cOCwtQgtvaIY5Bo6NqfwqCSK5S0KC8LjFyVfGoJrhATmuJq5/yDtgFP4y4Nskqbu7lzGkQOkBdOuRXRVSNqrJVut+KgNOLFYAZ0BeTb2csdk597nsrFWfF3Exeqr6WP6EcLYJmRqcci254YIRgXwDybvluVxEZjFwcB0ZaTB6JPRf/kCCQXAaRWAJtWadiNXpWdy+A9dy6m99wmhgNnLwlsIt/d1JRehnvpynvLcp20CWKLXeFXPnk4mmuFEDtiAfXE506zerY/3in8mkytvgMfv2Pq5M+ULLsKeXUJaHILlqhiTnQP31O2N4awFv5Ue//lObuhraIO7uuw/IEfujA== From: Yifeng Li To: Lee Jones , linux-mips@vger.kernel.org Cc: Yifeng Li , Jiaxun Yang , Huacai Chen , Ralf Baechle , Paul Burton , James Hogan , linux-kernel@vger.kernel.org Subject: [PATCH 0/7] Preliminary Platform Driver Support for Lemote Yeeloong Laptops Date: Sun, 3 Mar 2019 01:53:27 +0800 Message-Id: <20190302175334.5103-1-tomli@tomli.me> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Lemote Yeeloong is a laptop powered by Loongson 2F MIPS processor, primarily a demo platform for hobbyists and developers. It uses an ENE KB3310B Embedded Controller with customized firmware to implement hardware and power management. Due to the lack of separation of responsibilities and functions between different subsystems, the original platform driver submitted to the mailing list was a piece of monolithic module that implements numerous drivers, as a result, it was never accepted. This patch series was carefully reorganized and partially reimplemented to avoid those pitfalls in the original driver. This is the first part of the submission, which modifies the core MIPS code to introduce preliminary preparation for other subdrivers. Notably, it leverages a notify chain and MFD cells to avoid introducing unnecessary code into the core MIPS subsystem. It features the following... * Create a MFD driver for KB3310B controller, and move the original KB3310B controller code from mips/loongson64 to our new MFD driver. * Add yeeloong_sci driver support of System Control Interrupt to arch/mips/loongson64/lemote-2f. This piece of code is crucial and has to be included in loongson64/lemote-2f because it reprograms CS5536 southbridge GPIO to handle the underlying interrupts. * Originally, the SCI code was mixed into the hotkey driver. The new yeeloong_sci driver was written to avoid introducing unrelated subdriver code that is unsuitable for Linux/MIPS. It only handle a minimum set of core operations directly related to the hardware platform, and pass the events to other subdrivers via a notifier chain. As a result, the SCI logic and the specific hotkey handling logic have been decoupled. * Subdrivers - hwmon, battery, backlight, lcd and hotkey are registered as MFD cells in the MFD driver. It means onlf the MFD driver is resposible to register the upcoming subdrivers, the core board files mips/loongson64/ will not contain unrelated code. I've done everything I can think of to factor unrelated code out of the MIPS subsystem. I hope the refactored code would be acceptable now. Please review my changeset to see whether it's appropriate. Thanks, Yifeng Li (7): mfd: yeeloong_kb3310b: support KB3310B EC for Lemote Yeeloong laptops. mips: loongson64: select MFD_YEELOONG_KB3310B for LEMOTE_MACH2F. mips: loongson64: remove ec_kb3310b.c, use MFD driver. mips: loongson64: remove yeeloong_report_lid_status from pm.c mips: loongson64: register per-board platform drivers for lemote-2f mips: loongson64: Support System Control Interrupts for Lemote Yeeloong. MAINTAINERS: add myself as a maintainer of MIPS/Loongson2 platform code. MAINTAINERS | 16 + .../include/asm/mach-loongson64/loongson.h | 3 + arch/mips/loongson64/Kconfig | 1 + arch/mips/loongson64/common/platform.c | 15 + arch/mips/loongson64/lemote-2f/Makefile | 2 +- arch/mips/loongson64/lemote-2f/ec_kb3310b.c | 129 ------ arch/mips/loongson64/lemote-2f/ec_kb3310b.h | 188 --------- arch/mips/loongson64/lemote-2f/platform.c | 47 +++ arch/mips/loongson64/lemote-2f/pm.c | 38 +- arch/mips/loongson64/lemote-2f/reset.c | 4 +- arch/mips/loongson64/lemote-2f/sci.c | 392 ++++++++++++++++++ drivers/mfd/Kconfig | 10 + drivers/mfd/Makefile | 1 + drivers/mfd/yeeloong_kb3310b.c | 206 +++++++++ include/linux/mfd/yeeloong_kb3310b.h | 211 ++++++++++ 15 files changed, 913 insertions(+), 350 deletions(-) delete mode 100644 arch/mips/loongson64/lemote-2f/ec_kb3310b.c delete mode 100644 arch/mips/loongson64/lemote-2f/ec_kb3310b.h create mode 100644 arch/mips/loongson64/lemote-2f/platform.c create mode 100644 arch/mips/loongson64/lemote-2f/sci.c create mode 100644 drivers/mfd/yeeloong_kb3310b.c create mode 100644 include/linux/mfd/yeeloong_kb3310b.h -- 2.20.1