Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2497265iof; Wed, 8 Jun 2022 06:15:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6KsfWJdDCEF6px/VAwcF+BQi9TO+CC0rXNqNP/30AHtUYIVMwwtM9givlp8KOeNPBKdip X-Received: by 2002:a63:1819:0:b0:3fd:ac29:e9e9 with SMTP id y25-20020a631819000000b003fdac29e9e9mr14876108pgl.171.1654694157141; Wed, 08 Jun 2022 06:15:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654694157; cv=none; d=google.com; s=arc-20160816; b=lQC49Y7aScvsI62SL/UCn3trlbFdqlSfJe0fGvqgHPPJmolWNhWhWERXgW7VlSNteZ SBfH6qSQtlAOqT1agsRoW8Sa0JkLwJKXBzrA7xuUXKC8eFvJNYOYKFoQKbG4kzLWMCqE 1vG7OgSAj9YUcb3Kv4+vsd7g/SFnsSMjXEH9ecxxp9qvjkWwlZh7WvEgB3z6It6Ifiay wobNNTi83WY+OFSBNSaVc4tbZ4i2k7ov0RAIpg3KNJlzRP4IuRhPV9sZSqC8RMkrdPAT CmktxDd0UNez89OQ+g3Hu//tt70jGj60SldO2Z22BNfpEwgBDfHVK0hNABO2wvhkRApb 4tlQ== 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:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=ExR7nz1l+qJd8VCWWH8Z3rCzQytlVekQ7lshd0c3hog=; b=IedoqpCejqUQLQZ0Kis4i504AmpGBW2KClTUHYRy9ka0D4OcxZVxqpUAdiGEp1erWq lHYHjZ+zzM+6AH1FrR8K6Zg9RRasp7Xhawn5bSy+nEJs25wkMMxYPRKKMqrgDn6VopC/ mPjOYLp3KPE3l2YXANsSXGqoJlFm2FpydJ5J8YkGVr1CNpEO5p7hjoum+ILcPm/N2cM2 uZLOuETb8njxShQ7EU5UWSpQct5HCyYEDdMaV/9cUtdSqD9gVJxOf5kWCrbfLYb34bM8 ou0575hMgJqkSArpY3zehCGKoa9CSqOiqv4amZJOqd2KND2vIY2NfVdltd9hZTV1mNgC sUrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Fftmgi5L; dkim=pass header.i=@tq-group.com header.s=key1 header.b=jP2MLwlt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id k186-20020a6384c3000000b003fce072f541si23213613pgd.333.2022.06.08.06.15.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jun 2022 06:15:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@tq-group.com header.s=key1 header.b=Fftmgi5L; dkim=pass header.i=@tq-group.com header.s=key1 header.b=jP2MLwlt; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=tq-group.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 146FC205FA9; Wed, 8 Jun 2022 05:50:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239708AbiFHMuO (ORCPT + 99 others); Wed, 8 Jun 2022 08:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239639AbiFHMto (ORCPT ); Wed, 8 Jun 2022 08:49:44 -0400 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58A961A8990; Wed, 8 Jun 2022 05:49:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1654692582; x=1686228582; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ExR7nz1l+qJd8VCWWH8Z3rCzQytlVekQ7lshd0c3hog=; b=Fftmgi5Lg6X+dk6oFfvrgruMsZijFxAMKWAM/O3rv9YHkhQCo4YUULOu k4GLTS4XVW9lEcaG/Y1VUESTaIYFoPRa/t7QUORoFCxnheYRPwPpnDOh6 6c7E5BvUl8JrrKYht8bTMaL1Y8tcBE0zPh5ycxjY1idbZjC8d589lMbNI jtSAGvCG8GkAcvHUe9Aaep6/Q2MXWfC+bw3EeKD1rlZa1yN3taQbGtKOM G4QEIGxGjtGU3x7uhnSindARxCVs8ntgf4GSgaCOfmqgAhIyyFo8a5dUb orBVDzTSov0pG0c4zg2SYKja0ft3ZBcjFtAyxxp8ASfawci88bUrA8Nvd A==; X-IronPort-AV: E=Sophos;i="5.91,286,1647298800"; d="scan'208";a="24330547" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 08 Jun 2022 14:49:31 +0200 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 08 Jun 2022 14:49:31 +0200 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 08 Jun 2022 14:49:31 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1654692571; x=1686228571; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ExR7nz1l+qJd8VCWWH8Z3rCzQytlVekQ7lshd0c3hog=; b=jP2MLwltruQ3NkK9lrmNUwIM2s31p/VHimWt2Xbh/XTFZbhXVERYZmIZ qmrpkLhpA1adVe4e7PqhO4xR5Axsjz4mucj1z5U5210SYxhZI6HkJEcrA e1HCDKEcH1RPGvGnOGw3xorZ2LU8bqqQjRDEC8sCVK+sSeB1d2pJXDvm0 OzPybeiiVYOwE+Cjv8h4c8TuxwBuvhYQ1vtQPiIC7dU9Rv+hoebknpqnH xBi32MTvELu3mpda75DLwC7P5uX87eVgPgvRAESgoua37Hu/Uyx8b3nNH ttAahRwfag+nR54F8qcyivWBPDHT7P0NjNmGBPC8h0aAxfKHCGJCai2y5 w==; X-IronPort-AV: E=Sophos;i="5.91,286,1647298800"; d="scan'208";a="24330545" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 08 Jun 2022 14:49:31 +0200 Received: from localhost.localdomain (SCHIFFERM-M2.tq-net.de [10.121.49.136]) by vtuxmail01.tq-net.de (Postfix) with ESMTPA id 928FF280072; Wed, 8 Jun 2022 14:49:31 +0200 (CEST) From: Matthias Schiffer To: Dmitry Torokhov Cc: Lyude Paul , "Jason A. Donenfeld" , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Matthias Schiffer Subject: [PATCH 6/9] Input: synaptics-rmi4 - make rmi_f34v7_erase_all() use the "erase all" command Date: Wed, 8 Jun 2022 14:48:05 +0200 Message-Id: <20220608124808.51402-7-matthias.schiffer@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220608124808.51402-1-matthias.schiffer@ew.tq-group.com> References: <20220608124808.51402-1-matthias.schiffer@ew.tq-group.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org A full erase is required to recover from error conditions like "Bad Partition Table". Various individual partition erase commands can be (and need to be) omitted, as they will fail until a new partition table has been written. Signed-off-by: Matthias Schiffer --- drivers/input/rmi4/rmi_f34v7.c | 87 +--------------------------------- 1 file changed, 1 insertion(+), 86 deletions(-) diff --git a/drivers/input/rmi4/rmi_f34v7.c b/drivers/input/rmi4/rmi_f34v7.c index 9b78f98bb21c..9c1a73611761 100644 --- a/drivers/input/rmi4/rmi_f34v7.c +++ b/drivers/input/rmi4/rmi_f34v7.c @@ -608,58 +608,6 @@ static int rmi_f34v7_check_bl_config_size(struct f34_data *f34) return 0; } -static int rmi_f34v7_erase_config(struct f34_data *f34) -{ - int ret; - - dev_info(&f34->fn->dev, "Erasing config...\n"); - - init_completion(&f34->v7.cmd_done); - - switch (f34->v7.config_area) { - case v7_UI_CONFIG_AREA: - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_CONFIG); - if (ret < 0) - return ret; - break; - case v7_DP_CONFIG_AREA: - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_DISP_CONFIG); - if (ret < 0) - return ret; - break; - case v7_BL_CONFIG_AREA: - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_BL_CONFIG); - if (ret < 0) - return ret; - break; - } - - ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS); - if (ret < 0) - return ret; - - return 0; -} - -static int rmi_f34v7_erase_guest_code(struct f34_data *f34) -{ - int ret; - - dev_info(&f34->fn->dev, "Erasing guest code...\n"); - - init_completion(&f34->v7.cmd_done); - - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_GUEST_CODE); - if (ret < 0) - return ret; - - ret = rmi_f34v7_check_command_status(f34, F34_ERASE_WAIT_MS); - if (ret < 0) - return ret; - - return 0; -} - static int rmi_f34v7_erase_all(struct f34_data *f34) { int ret; @@ -668,7 +616,7 @@ static int rmi_f34v7_erase_all(struct f34_data *f34) init_completion(&f34->v7.cmd_done); - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_UI_FIRMWARE); + ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_ALL); if (ret < 0) return ret; @@ -676,24 +624,6 @@ static int rmi_f34v7_erase_all(struct f34_data *f34) if (ret < 0) return ret; - f34->v7.config_area = v7_UI_CONFIG_AREA; - ret = rmi_f34v7_erase_config(f34); - if (ret < 0) - return ret; - - if (f34->v7.has_display_cfg) { - f34->v7.config_area = v7_DP_CONFIG_AREA; - ret = rmi_f34v7_erase_config(f34); - if (ret < 0) - return ret; - } - - if (f34->v7.has_guest_code) { - ret = rmi_f34v7_erase_guest_code(f34); - if (ret < 0) - return ret; - } - return 0; } @@ -897,17 +827,6 @@ static int rmi_f34v7_write_flash_config(struct f34_data *f34) init_completion(&f34->v7.cmd_done); - ret = rmi_f34v7_write_command(f34, v7_CMD_ERASE_FLASH_CONFIG); - if (ret < 0) - return ret; - - rmi_dbg(RMI_DEBUG_FN, &f34->fn->dev, - "%s: Erase flash config command written\n", __func__); - - ret = rmi_f34v7_check_command_status(f34, F34_WRITE_WAIT_MS); - if (ret < 0) - return ret; - ret = rmi_f34v7_write_config(f34); if (ret < 0) return ret; @@ -937,10 +856,6 @@ static int rmi_f34v7_write_partition_table(struct f34_data *f34) if (ret < 0) return ret; - ret = rmi_f34v7_erase_config(f34); - if (ret < 0) - return ret; - ret = rmi_f34v7_write_flash_config(f34); if (ret < 0) return ret; -- 2.25.1