Skip to content

Commit 3ee9bc1

Browse files
b-rad-NDimchehab
authored andcommitted
media: cx25840: Use subdev host data for PLL override
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 <brad@nextdimension.cc> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
1 parent 9cbf518 commit 3ee9bc1

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

‎drivers/media/i2c/cx25840/cx25840-core.c‎

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -463,8 +463,13 @@ static void cx23885_initialize(struct i2c_client *client)
463463
{
464464
DEFINE_WAIT(wait);
465465
struct cx25840_state *state = to_state(i2c_get_clientdata(client));
466+
u32 clk_freq = 0;
466467
struct workqueue_struct *q;
467468

469+
/* cx23885 sets hostdata to clk_freq pointer */
470+
if (v4l2_get_subdev_hostdata(&state->sd))
471+
clk_freq = *((u32 *)v4l2_get_subdev_hostdata(&state->sd));
472+
468473
/*
469474
* Come out of digital power down
470475
* The CX23888, at least, needs this, otherwise registers aside from
@@ -500,8 +505,13 @@ static void cx23885_initialize(struct i2c_client *client)
500505
* 50.0 MHz * (0xb + 0xe8ba26/0x2000000)/4 = 5 * 28.636363 MHz
501506
* 572.73 MHz before post divide
502507
*/
503-
/* HVR1850 or 50MHz xtal */
504-
cx25840_write(client, 0x2, 0x71);
508+
if (clk_freq == 25000000) {
509+
/* 888/ImpactVCBe or 25Mhz xtal */
510+
; /* nothing to do */
511+
} else {
512+
/* HVR1850 or 50MHz xtal */
513+
cx25840_write(client, 0x2, 0x71);
514+
}
505515
cx25840_write4(client, 0x11c, 0x01d1744c);
506516
cx25840_write4(client, 0x118, 0x00000416);
507517
cx25840_write4(client, 0x404, 0x0010253e);
@@ -544,9 +554,15 @@ static void cx23885_initialize(struct i2c_client *client)
544554
/* HVR1850 */
545555
switch (state->id) {
546556
case CX23888_AV:
547-
/* 888/HVR1250 specific */
548-
cx25840_write4(client, 0x10c, 0x13333333);
549-
cx25840_write4(client, 0x108, 0x00000515);
557+
if (clk_freq == 25000000) {
558+
/* 888/ImpactVCBe or 25MHz xtal */
559+
cx25840_write4(client, 0x10c, 0x01b6db7b);
560+
cx25840_write4(client, 0x108, 0x00000512);
561+
} else {
562+
/* 888/HVR1250 or 50MHz xtal */
563+
cx25840_write4(client, 0x10c, 0x13333333);
564+
cx25840_write4(client, 0x108, 0x00000515);
565+
}
550566
break;
551567
default:
552568
cx25840_write4(client, 0x10c, 0x002be2c9);
@@ -576,7 +592,7 @@ static void cx23885_initialize(struct i2c_client *client)
576592
* 368.64 MHz before post divide
577593
* 122.88 MHz / 0xa = 12.288 MHz
578594
*/
579-
/* HVR1850 or 50MHz xtal */
595+
/* HVR1850 or 50MHz xtal or 25MHz xtal */
580596
cx25840_write4(client, 0x114, 0x017dbf48);
581597
cx25840_write4(client, 0x110, 0x000a030e);
582598
break;

0 commit comments

Comments
 (0)