Merge branch 'work.regset' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux/fpc-iii.git] / drivers / media / tuners / fc2580_priv.h
blob8fa88a3c4f5fad72fca067f442624dcff648dcc2
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
2 /*
3 * FCI FC2580 silicon tuner driver
5 * Copyright (C) 2012 Antti Palosaari <crope@iki.fi>
6 */
8 #ifndef FC2580_PRIV_H
9 #define FC2580_PRIV_H
11 #include "fc2580.h"
12 #include <media/v4l2-ctrls.h>
13 #include <media/v4l2-subdev.h>
14 #include <linux/regmap.h>
15 #include <linux/math64.h>
17 struct fc2580_reg_val {
18 u8 reg;
19 u8 val;
22 static const struct fc2580_reg_val fc2580_init_reg_vals[] = {
23 {0x00, 0x00},
24 {0x12, 0x86},
25 {0x14, 0x5c},
26 {0x16, 0x3c},
27 {0x1f, 0xd2},
28 {0x09, 0xd7},
29 {0x0b, 0xd5},
30 {0x0c, 0x32},
31 {0x0e, 0x43},
32 {0x21, 0x0a},
33 {0x22, 0x82},
34 {0x45, 0x10},
35 {0x4c, 0x00},
36 {0x3f, 0x88},
37 {0x02, 0x0e},
38 {0x58, 0x14},
41 struct fc2580_pll {
42 u32 freq;
43 u8 div_out;
44 u8 band;
47 static const struct fc2580_pll fc2580_pll_lut[] = {
48 /* VCO min VCO max */
49 { 400000000, 12, 0x80}, /* .......... 4800000000 */
50 {1000000000, 4, 0x00}, /* 1600000000 4000000000 */
51 {0xffffffff, 2, 0x40}, /* 2000000000 .......... */
54 struct fc2580_if_filter {
55 u32 freq;
56 u8 r36_val;
57 u8 r39_val;
60 static const struct fc2580_if_filter fc2580_if_filter_lut[] = {
61 { 6000000, 0x18, 0x00},
62 { 7000000, 0x18, 0x80},
63 { 8000000, 0x18, 0x80},
64 {0xffffffff, 0x18, 0x80},
67 struct fc2580_freq_regs {
68 u32 freq;
69 u8 r25_val;
70 u8 r27_val;
71 u8 r28_val;
72 u8 r29_val;
73 u8 r2b_val;
74 u8 r2c_val;
75 u8 r2d_val;
76 u8 r30_val;
77 u8 r44_val;
78 u8 r50_val;
79 u8 r53_val;
80 u8 r5f_val;
81 u8 r61_val;
82 u8 r62_val;
83 u8 r63_val;
84 u8 r67_val;
85 u8 r68_val;
86 u8 r69_val;
87 u8 r6a_val;
88 u8 r6b_val;
89 u8 r6c_val;
90 u8 r6d_val;
91 u8 r6e_val;
92 u8 r6f_val;
95 /* XXX: 0xff is used for don't-care! */
96 static const struct fc2580_freq_regs fc2580_freq_regs_lut[] = {
97 { 400000000,
98 0xff, 0x77, 0x33, 0x40, 0xff, 0xff, 0xff, 0x09, 0xff, 0x8c,
99 0x50, 0x0f, 0x07, 0x00, 0x15, 0x03, 0x05, 0x10, 0x12, 0x08,
100 0x0a, 0x78, 0x32, 0x54},
101 { 538000000,
102 0xf0, 0x77, 0x53, 0x60, 0xff, 0xff, 0x9f, 0x09, 0xff, 0x8c,
103 0x50, 0x13, 0x07, 0x06, 0x15, 0x06, 0x08, 0x10, 0x12, 0x0b,
104 0x0c, 0x78, 0x32, 0x14},
105 { 794000000,
106 0xf0, 0x77, 0x53, 0x60, 0xff, 0xff, 0x9f, 0x09, 0xff, 0x8c,
107 0x50, 0x15, 0x03, 0x03, 0x15, 0x03, 0x05, 0x0c, 0x0e, 0x0b,
108 0x0c, 0x78, 0x32, 0x14},
109 {1000000000,
110 0xf0, 0x77, 0x53, 0x60, 0xff, 0xff, 0x8f, 0x09, 0xff, 0x8c,
111 0x50, 0x15, 0x07, 0x06, 0x15, 0x07, 0x09, 0x10, 0x12, 0x0b,
112 0x0c, 0x78, 0x32, 0x14},
113 {0xffffffff,
114 0xff, 0xff, 0xff, 0xff, 0x70, 0x37, 0xe7, 0x09, 0x20, 0x8c,
115 0x50, 0x0f, 0x0f, 0x00, 0x13, 0x00, 0x02, 0x0c, 0x0e, 0x08,
116 0x0a, 0xa0, 0x50, 0x14},
119 struct fc2580_dev {
120 u32 clk;
121 struct i2c_client *client;
122 struct regmap *regmap;
123 struct v4l2_subdev subdev;
124 bool active;
125 unsigned int f_frequency;
126 unsigned int f_bandwidth;
128 /* Controls */
129 struct v4l2_ctrl_handler hdl;
130 struct v4l2_ctrl *bandwidth_auto;
131 struct v4l2_ctrl *bandwidth;
134 #endif