Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp917817ybl; Fri, 24 Jan 2020 11:58:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzJwCXbTugOGgDp/44r+DO9utGK+bnJNtvijm1JMqB/CZthdudCH0nRSjJKpr8giwZahiYO X-Received: by 2002:aca:3542:: with SMTP id c63mr341361oia.135.1579895884818; Fri, 24 Jan 2020 11:58:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1579895884; cv=none; d=google.com; s=arc-20160816; b=KO+EDEVK34i5Jwt+nr6tTn5dYmt0b02INehSNLA1t47RF69HKU8qpwBLEyUiQ19RwC fKPL5Puqp+qZVSkZGqbV7dibXTpfIScvvBnirUvNrgrWT4KOwwx2TArswrsG9JQMURKk 0YFxvFyITxxfvsb689A0FxlQBcqYuHIAyCjKBqDAlFk23E6q4sVIPeaxaJCfDgzCujMy /+H16IgvtWhLViQCr9oIR8j6y1czu0h/FLyaBKrxZQ54c2OUXxxUZhVEsNZaPxmXoS7M lI3sH9gsyFWEfCwE1YMD6yM0RGmQ75hYxpQH6G0Fnbqpi6CyDGqedGm5x2z/eCqrdynt dJ+Q== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+fz/griyqWktAXPSwk9F+viuiyNctddzbmbwH2vfUQA=; b=gPx1RTf/LccYhQwrOpyFCMvHxS/cdoUUi4ktuc+AvaU7juCWMW2QuWSeKYWIpOpOHE Baimd6qHl8FT0jZJIQnM+21+FEONiddngwQLu7ZZMntZbvU/jDazw9PQEF7gtu9+RHT3 IlmLxULJvFe1HPnHDmBKkQQZnuGEe18FBaRqbGK1BbTVGnH6uXNRDZHgDLv7/31yEz/J CAKViRciMHSmAUx6x3vq9S+y9Q96e3d2SA5+pfIdeg34Hetur5ZRQ6iZ7cX507hpX2d0 5x5lv2ahmhBkCb1J1GoqfwgvrkmVKJPNgvqUmVylI6dxk/GGcyuV4Vz9faTkBLyWG0yj AlJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=vrmTadlo; 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 m26si3342921otn.307.2020.01.24.11.57.52; Fri, 24 Jan 2020 11:58:04 -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=@kernel.org header.s=default header.b=vrmTadlo; 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 S2392118AbgAXLmP (ORCPT + 99 others); Fri, 24 Jan 2020 06:42:15 -0500 Received: from mail.kernel.org ([198.145.29.99]:50226 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389695AbgAXLNw (ORCPT ); Fri, 24 Jan 2020 06:13:52 -0500 Received: from localhost (ip-213-127-102-57.ip.prioritytelecom.net [213.127.102.57]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9DF6D2077C; Fri, 24 Jan 2020 11:13:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1579864431; bh=k7VpQ2HWw1DFJqwi44KrSWhS4YrO2NNiRLH07SXh4u8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vrmTadloXVV+ipAZkcmylaF7zjG95e5SIFPsXEo1mTaW0xq4m0YM7HfiYxs20AdNy DjNjt4Mkhm87neoNN9nn0TGfDcSege7LZ33fFKeLR2AuMwx1cAneoRuvT7gCL4fjfy lxftEU1zUiCmUURRDbeoUOj3j7Fx6eToeo31EnMM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Akihiro Tsukada , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 250/639] media: dvb/earth-pt1: fix wrong initialization for demod blocks Date: Fri, 24 Jan 2020 10:27:00 +0100 Message-Id: <20200124093118.061033210@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200124093047.008739095@linuxfoundation.org> References: <20200124093047.008739095@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Akihiro Tsukada [ Upstream commit 15d90a6ae98e6d2c68497b44a491cb9efbb98ab1 ] earth-pt1 driver was decomposed/restructured by the commit b732539efdba ("media: dvb: earth-pt1: decompose pt1 driver into sub drivers"), but it introduced a problem regarding concurrent streaming: Opening a new terrestial stream stops the reception of an existing, already-opened satellite stream. The demod IC in earth-pt1 boards contains 2 pairs of terr. and sat. blocks, supporting 4 concurrent demodulations, and the above problem was because the config of a terr. block contained whole reset/init of the pair blocks, thus each open() of a terrestrial frontend wrongly cleared the config of its peer satellite block of the demod. This whole/pair reset should be executed earlier and not on each open(). Fixes: b732539efdba ("media: dvb: earth-pt1: decompose pt1 driver into sub drivers") Signed-off-by: Akihiro Tsukada Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/pt1/pt1.c | 54 ++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c index 7f878fc41b7e6..93fecffb36ee7 100644 --- a/drivers/media/pci/pt1/pt1.c +++ b/drivers/media/pci/pt1/pt1.c @@ -200,16 +200,10 @@ static const u8 va1j5jf8007t_25mhz_configs[][2] = { static int config_demod(struct i2c_client *cl, enum pt1_fe_clk clk) { int ret; - u8 buf[2] = {0x01, 0x80}; bool is_sat; const u8 (*cfg_data)[2]; int i, len; - ret = i2c_master_send(cl, buf, 2); - if (ret < 0) - return ret; - usleep_range(30000, 50000); - is_sat = !strncmp(cl->name, TC90522_I2C_DEV_SAT, strlen(TC90522_I2C_DEV_SAT)); if (is_sat) { @@ -260,6 +254,46 @@ static int config_demod(struct i2c_client *cl, enum pt1_fe_clk clk) return 0; } +/* + * Init registers for (each pair of) terrestrial/satellite block in demod. + * Note that resetting terr. block also resets its peer sat. block as well. + * This function must be called before configuring any demod block + * (before pt1_wakeup(), fe->ops.init()). + */ +static int pt1_demod_block_init(struct pt1 *pt1) +{ + struct i2c_client *cl; + u8 buf[2] = {0x01, 0x80}; + int ret; + int i; + + /* reset all terr. & sat. pairs first */ + for (i = 0; i < PT1_NR_ADAPS; i++) { + cl = pt1->adaps[i]->demod_i2c_client; + if (strncmp(cl->name, TC90522_I2C_DEV_TER, + strlen(TC90522_I2C_DEV_TER))) + continue; + + ret = i2c_master_send(cl, buf, 2); + if (ret < 0) + return ret; + usleep_range(30000, 50000); + } + + for (i = 0; i < PT1_NR_ADAPS; i++) { + cl = pt1->adaps[i]->demod_i2c_client; + if (strncmp(cl->name, TC90522_I2C_DEV_SAT, + strlen(TC90522_I2C_DEV_SAT))) + continue; + + ret = i2c_master_send(cl, buf, 2); + if (ret < 0) + return ret; + usleep_range(30000, 50000); + } + return 0; +} + static void pt1_write_reg(struct pt1 *pt1, int reg, u32 data) { writel(data, pt1->regs + reg * 4); @@ -987,6 +1021,10 @@ static int pt1_init_frontends(struct pt1 *pt1) goto tuner_release; } + ret = pt1_demod_block_init(pt1); + if (ret < 0) + goto fe_unregister; + return 0; tuner_release: @@ -1245,6 +1283,10 @@ static int pt1_resume(struct device *dev) pt1_update_power(pt1); usleep_range(1000, 2000); + ret = pt1_demod_block_init(pt1); + if (ret < 0) + goto resume_err; + for (i = 0; i < PT1_NR_ADAPS; i++) dvb_frontend_reinitialise(pt1->adaps[i]->fe); -- 2.20.1