Received: by 10.192.165.148 with SMTP id m20csp2454343imm; Sun, 22 Apr 2018 07:23:09 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/VsW+UljC0CF49hn6F9ty91ftkt6tce3X43gJYODHMa+fdL/H19Zii/TScofPhbZ57aeF7 X-Received: by 2002:a17:902:70c4:: with SMTP id l4-v6mr17385962plt.382.1524406989014; Sun, 22 Apr 2018 07:23:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524406988; cv=none; d=google.com; s=arc-20160816; b=Vy2ucAmLDbG/DJlQ3ofpGIt0KZS3Faip+bYdFxG9tSES5lCWvdOrRx0/y4hMfu/GGB +cjYK3ae02d0Lqo4TakGVN09gTKyStUV+xFvP+qFfZb5fxWcr8Qh9XwIHZfLN9dQX3lT wYki+R0Kx3sSlDNcvIU1m/vyt0NVhW02fCo7G1myEORcl2IcnpY4jl3POsF+fbmOzjpx 9y/58jkDYKnJa1lA3PgjqHbtOUrroPSp/SofuLNDUG4msGINuDGTP0YNeTmWglGObFxm W3qls2Vql+x7943ENMn74JAJ7OgzaOW3qlu28wlA4BpeobSvVwB/r8maW+h4TPealOkP q0uA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=7kTnDUQawUkUl3qARt9NYIH1mfe/lAgS/IAwCcDPKRE=; b=YOtC+hUd0aQ/POoEJhFrr2BVLLfj/V4rpasOMU6NGTbBiD1ID1KUp3iBal3ml/tWoQ gSoRiO6Uh+RZY4CeD6pkULKsid51p4x2lc6g+fZSeWCktFndY9dDe6WAGeZRZdrrd4p9 844Z/aJXtb+TT48x0t+4yGwZxDkxn7N3eq10boNKhUMficSitsOrFruBxFu1CT7dPZyA TOQ+IdZJetuxeZVRw8Sx/oPBE2qFAqZ9t1S4iMoDJ31liZeWeoyEMYxjeWl2qDYVN1/r GEr9LDMQZZJMxY8PdLVOvbctnhsNMzsVUaelaH7pDS+1tHg+ShtJk06FyNQ8BnDBrFSY vmeA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d21-v6si9942598plr.352.2018.04.22.07.22.54; Sun, 22 Apr 2018 07:23:08 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757638AbeDVOV4 (ORCPT + 99 others); Sun, 22 Apr 2018 10:21:56 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33100 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755881AbeDVOVv (ORCPT ); Sun, 22 Apr 2018 10:21:51 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 63AACCF1; Sun, 22 Apr 2018 14:21:50 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, James Kelly , Mark Brown Subject: [PATCH 3.18 22/52] ASoC: ssm2602: Replace reg_default_raw with reg_default Date: Sun, 22 Apr 2018 15:53:55 +0200 Message-Id: <20180422135316.306919125@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135315.254787616@linuxfoundation.org> References: <20180422135315.254787616@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: James Kelly commit a01df75ce737951ad13a08d101306e88c3f57cb2 upstream. SSM2602 driver is broken on recent kernels (at least since 4.9). User space applications such as amixer or alsamixer get EIO when attempting to access codec controls via the relevant IOCTLs. Root cause of these failures is the regcache_hw_init function in drivers/base/regmap/regcache.c, which prevents regmap cache initalization from the reg_defaults_raw element of the regmap_config structure when registers are write only. It also disables the regmap cache entirely when all registers are write only or volatile as is the case for the SSM2602 driver. Using the reg_defaults element of the regmap_config structure rather than the reg_defaults_raw element to initalize the regmap cache avoids the logic in the regcache_hw_init function entirely. It also makes this driver consistent with other ASoC codec drivers, as this driver was the ONLY codec driver that used the reg_defaults_raw element to initalize the cache. Tested on Digilent Zybo Z7 development board which has a SSM2603 codec chip connected to a Xilinx Zynq SoC. Signed-off-by: James Kelly Signed-off-by: Mark Brown Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- sound/soc/codecs/ssm2602.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) --- a/sound/soc/codecs/ssm2602.c +++ b/sound/soc/codecs/ssm2602.c @@ -54,10 +54,17 @@ struct ssm2602_priv { * using 2 wire for device control, so we cache them instead. * There is no point in caching the reset register */ -static const u16 ssm2602_reg[SSM2602_CACHEREGNUM] = { - 0x0097, 0x0097, 0x0079, 0x0079, - 0x000a, 0x0008, 0x009f, 0x000a, - 0x0000, 0x0000 +static const struct reg_default ssm2602_reg[SSM2602_CACHEREGNUM] = { + { .reg = 0x00, .def = 0x0097 }, + { .reg = 0x01, .def = 0x0097 }, + { .reg = 0x02, .def = 0x0079 }, + { .reg = 0x03, .def = 0x0079 }, + { .reg = 0x04, .def = 0x000a }, + { .reg = 0x05, .def = 0x0008 }, + { .reg = 0x06, .def = 0x009f }, + { .reg = 0x07, .def = 0x000a }, + { .reg = 0x08, .def = 0x0000 }, + { .reg = 0x09, .def = 0x0000 } }; @@ -620,8 +627,8 @@ const struct regmap_config ssm2602_regma .volatile_reg = ssm2602_register_volatile, .cache_type = REGCACHE_RBTREE, - .reg_defaults_raw = ssm2602_reg, - .num_reg_defaults_raw = ARRAY_SIZE(ssm2602_reg), + .reg_defaults = ssm2602_reg, + .num_reg_defaults = ARRAY_SIZE(ssm2602_reg), }; EXPORT_SYMBOL_GPL(ssm2602_regmap_config);