Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2010171imm; Tue, 10 Jul 2018 11:32:21 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcdqmZkuyr1t1qgbEoN63FLJmYxRWsRSdb53ZLa2yzRCNUFqGG/Eni9M02WYhu/WuLBsfP1 X-Received: by 2002:a17:902:43a4:: with SMTP id j33-v6mr25760764pld.118.1531247541130; Tue, 10 Jul 2018 11:32:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531247541; cv=none; d=google.com; s=arc-20160816; b=iIRWJvfGT2H1g8X5tmRo/ORPlEyc+bFSp9LEz1R8ie5vscXNucQiCJrcsPC9V1Py51 dgCuw0Fr4noxCjxMmtfBgeLKUwQTlcG1RBE96Q2iE0s46H2x8m40sy6E8dwbOGoY6WD7 uY0pNziQ73ERe35ibg85f3WTx1qT4nHUOyYHTy8fNZgjoxMD48X1po4omD5usgfKoKDd LZ5T3Y450vUn9ABDnZwCyREuzK00pwjBVBKBQFYtxp/gicFlockqV2zI+A79sYwj076p FPudm7BBMxDe0h4d57LUkbGnU1Q5FtIjI0QTigXXM4L4Jg5b+Z6dAVRigmxcrc5BSkq4 sQLQ== 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=Cc2iO9OgFddlguWq2xPp8boP4ynGJcdNaWt3xFjLat8=; b=mvVpIA12hXm4+eSHgO29wtfNoz7UyfrU5HS7wy2CEq8slFBzCXX9OG/caajJa2qBHG jS8/vYQyAxB/RsTgtzsQTFv6bIJVxzHJTlSI4g/ns0K0AwRnuTkYdwq2cod5E3Mbqcyb memTLsCz6/yDbN8iIlpJ34Wz82vfLuVHIVq0jzCyTn4VIr8i+0emu0TF9NJ7K3p+uNek EecKyTzOTiGogypvNQnC0LoABX3Fe34bDZFH5mqoXcb4Q7BAL4LphyQBY8QkfAO43daA gi70/rD5s6kFBWn/pQpdATLwzGBp7c+SQGP9h3IqSfhZgjoAbXgJvALEksb9QzPMpnxC D4lA== 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 l21-v6si18389018pfk.321.2018.07.10.11.32.06; Tue, 10 Jul 2018 11:32:21 -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 S2388243AbeGJSbB (ORCPT + 99 others); Tue, 10 Jul 2018 14:31:01 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45700 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732400AbeGJSbA (ORCPT ); Tue, 10 Jul 2018 14:31:00 -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 3307DEC2; Tue, 10 Jul 2018 18:30:48 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Brad Love , Mauro Carvalho Chehab , Ben Hutchings Subject: [PATCH 4.9 42/52] media: cx25840: Use subdev host data for PLL override Date: Tue, 10 Jul 2018 20:25:10 +0200 Message-Id: <20180710182453.334057799@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710182449.285532226@linuxfoundation.org> References: <20180710182449.285532226@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 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Brad Love commit 3ee9bc12342cf546313d300808ff47d7dbb8e7db upstream. The cx25840 driver currently configures 885, 887, and 888 using default divisors for each chip. This check to see if the cx23885 driver has passed the cx25840 a non-default clock rate for a specific chip. If a cx23885 board has left clk_freq at 0, the clock default values will be used to configure the PLLs. This patch only has effect on 888 boards who set clk_freq to 25M. Signed-off-by: Brad Love Signed-off-by: Mauro Carvalho Chehab Cc: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- drivers/media/i2c/cx25840/cx25840-core.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) --- a/drivers/media/i2c/cx25840/cx25840-core.c +++ b/drivers/media/i2c/cx25840/cx25840-core.c @@ -467,8 +467,13 @@ static void cx23885_initialize(struct i2 { DEFINE_WAIT(wait); struct cx25840_state *state = to_state(i2c_get_clientdata(client)); + u32 clk_freq = 0; struct workqueue_struct *q; + /* cx23885 sets hostdata to clk_freq pointer */ + if (v4l2_get_subdev_hostdata(&state->sd)) + clk_freq = *((u32 *)v4l2_get_subdev_hostdata(&state->sd)); + /* * Come out of digital power down * The CX23888, at least, needs this, otherwise registers aside from @@ -504,8 +509,13 @@ static void cx23885_initialize(struct i2 * 50.0 MHz * (0xb + 0xe8ba26/0x2000000)/4 = 5 * 28.636363 MHz * 572.73 MHz before post divide */ - /* HVR1850 or 50MHz xtal */ - cx25840_write(client, 0x2, 0x71); + if (clk_freq == 25000000) { + /* 888/ImpactVCBe or 25Mhz xtal */ + ; /* nothing to do */ + } else { + /* HVR1850 or 50MHz xtal */ + cx25840_write(client, 0x2, 0x71); + } cx25840_write4(client, 0x11c, 0x01d1744c); cx25840_write4(client, 0x118, 0x00000416); cx25840_write4(client, 0x404, 0x0010253e); @@ -548,9 +558,15 @@ static void cx23885_initialize(struct i2 /* HVR1850 */ switch (state->id) { case CX23888_AV: - /* 888/HVR1250 specific */ - cx25840_write4(client, 0x10c, 0x13333333); - cx25840_write4(client, 0x108, 0x00000515); + if (clk_freq == 25000000) { + /* 888/ImpactVCBe or 25MHz xtal */ + cx25840_write4(client, 0x10c, 0x01b6db7b); + cx25840_write4(client, 0x108, 0x00000512); + } else { + /* 888/HVR1250 or 50MHz xtal */ + cx25840_write4(client, 0x10c, 0x13333333); + cx25840_write4(client, 0x108, 0x00000515); + } break; default: cx25840_write4(client, 0x10c, 0x002be2c9); @@ -580,7 +596,7 @@ static void cx23885_initialize(struct i2 * 368.64 MHz before post divide * 122.88 MHz / 0xa = 12.288 MHz */ - /* HVR1850 or 50MHz xtal */ + /* HVR1850 or 50MHz xtal or 25MHz xtal */ cx25840_write4(client, 0x114, 0x017dbf48); cx25840_write4(client, 0x110, 0x000a030e); break;