| .. | .. |
|---|
| 10 | 10 | * 2. add get virtual channel hotplug status ioctl |
|---|
| 11 | 11 | * 3. add virtual channel hotplug status event report to vicap |
|---|
| 12 | 12 | * 4. fixup variables are reused when multiple devices use the same driver |
|---|
| 13 | | - * V0.0X02.0x00 version. |
|---|
| 14 | | - * 1,support auto detect format when plugging |
|---|
| 15 | | - * 2,support quick stream when reset vicap |
|---|
| 13 | + * V0.0X02.0X00 version. |
|---|
| 14 | + * 1. update init registers setting |
|---|
| 15 | + * 2. nvp6188 do not stream after writing registers setting |
|---|
| 16 | + * 3. support detect fmt change when hotplug ahd camera |
|---|
| 17 | + * 4. support 1600x1300 ahd camera input |
|---|
| 16 | 18 | */ |
|---|
| 17 | 19 | |
|---|
| 18 | 20 | //#define DEBUG |
|---|
| .. | .. |
|---|
| 36 | 38 | #include <linux/rk-preisp.h> |
|---|
| 37 | 39 | #include <linux/sched.h> |
|---|
| 38 | 40 | #include <linux/kthread.h> |
|---|
| 39 | | - |
|---|
| 40 | 41 | #include <sound/core.h> |
|---|
| 41 | 42 | #include <sound/pcm.h> |
|---|
| 42 | 43 | #include <sound/pcm_params.h> |
|---|
| 43 | 44 | #include <sound/soc.h> |
|---|
| 44 | 45 | #include <sound/tlv.h> |
|---|
| 45 | | - |
|---|
| 46 | 46 | #include <linux/platform_device.h> |
|---|
| 47 | 47 | #include <linux/input.h> |
|---|
| 48 | +#include "nvp6188.h" |
|---|
| 48 | 49 | |
|---|
| 49 | 50 | #define DRIVER_VERSION KERNEL_VERSION(0, 0x02, 0x0) |
|---|
| 50 | 51 | |
|---|
| .. | .. |
|---|
| 80 | 81 | #endif |
|---|
| 81 | 82 | |
|---|
| 82 | 83 | #define NVP_RESO_960H_NSTC_VALUE 0x00 |
|---|
| 83 | | -#define NVP_RESO_960H_PAL_VALUE 0x10 |
|---|
| 84 | +#define NVP_RESO_960H_PAL_VALUE 0x10 |
|---|
| 84 | 85 | #define NVP_RESO_720P_NSTC_VALUE 0x20 |
|---|
| 85 | | -#define NVP_RESO_720P_PAL_VALUE 0x21 |
|---|
| 86 | +#define NVP_RESO_720P_PAL_VALUE 0x21 |
|---|
| 86 | 87 | #define NVP_RESO_1080P_NSTC_VALUE 0x30 |
|---|
| 87 | 88 | #define NVP_RESO_1080P_PAL_VALUE 0x31 |
|---|
| 88 | 89 | #define NVP_RESO_960P_NSTC_VALUE 0xa0 |
|---|
| 89 | | -#define NVP_RESO_960P_PAL_VALUE 0xa1 |
|---|
| 90 | | - |
|---|
| 91 | | -enum nvp6188_max_pad { |
|---|
| 92 | | - PAD0, |
|---|
| 93 | | - PAD1, |
|---|
| 94 | | - PAD2, |
|---|
| 95 | | - PAD3, |
|---|
| 96 | | - PAD_MAX, |
|---|
| 97 | | -}; |
|---|
| 90 | +#define NVP_RESO_960P_PAL_VALUE 0xa1 |
|---|
| 91 | +#define NVP_RESO_1300P_NSTC_VALUE 0x3A |
|---|
| 92 | +#define NVP_RESO_1300P_PAL_VALUE 0x3B |
|---|
| 98 | 93 | |
|---|
| 99 | 94 | enum nvp6188_support_reso { |
|---|
| 100 | 95 | NVP_RESO_UNKOWN = 0, |
|---|
| .. | .. |
|---|
| 102 | 97 | NVP_RESO_720P_PAL, |
|---|
| 103 | 98 | NVP_RESO_960P_PAL, |
|---|
| 104 | 99 | NVP_RESO_1080P_PAL, |
|---|
| 100 | + NVP_RESO_1300P_PAL, |
|---|
| 105 | 101 | NVP_RESO_960H_NSTC, |
|---|
| 106 | 102 | NVP_RESO_720P_NSTC, |
|---|
| 107 | 103 | NVP_RESO_960P_NSTC, |
|---|
| 108 | 104 | NVP_RESO_1080P_NSTC, |
|---|
| 105 | + NVP_RESO_1300P_NSTC, |
|---|
| 109 | 106 | }; |
|---|
| 110 | 107 | |
|---|
| 111 | 108 | /* Audio output port formats */ |
|---|
| .. | .. |
|---|
| 133 | 130 | u32 hdr_mode; |
|---|
| 134 | 131 | u32 vc[PAD_MAX]; |
|---|
| 135 | 132 | u32 channel_reso[PAD_MAX]; |
|---|
| 133 | + u32 unkown_reso_count[PAD_MAX]; |
|---|
| 136 | 134 | }; |
|---|
| 137 | 135 | |
|---|
| 138 | 136 | struct nvp6188_audio { |
|---|
| .. | .. |
|---|
| 146 | 144 | struct gpio_desc *reset_gpio; |
|---|
| 147 | 145 | struct gpio_desc *power_gpio; |
|---|
| 148 | 146 | struct gpio_desc *vi_gpio; |
|---|
| 149 | | - |
|---|
| 150 | 147 | struct pinctrl *pinctrl; |
|---|
| 151 | 148 | struct pinctrl_state *pins_default; |
|---|
| 152 | 149 | struct pinctrl_state *pins_sleep; |
|---|
| 153 | | - |
|---|
| 154 | 150 | struct v4l2_subdev subdev; |
|---|
| 155 | 151 | struct media_pad pad; |
|---|
| 156 | 152 | struct v4l2_ctrl_handler ctrl_handler; |
|---|
| .. | .. |
|---|
| 159 | 155 | struct mutex mutex; |
|---|
| 160 | 156 | bool power_on; |
|---|
| 161 | 157 | struct nvp6188_mode cur_mode; |
|---|
| 162 | | - |
|---|
| 163 | 158 | u32 module_index; |
|---|
| 164 | 159 | u32 cfg_num; |
|---|
| 165 | 160 | const char *module_facing; |
|---|
| 166 | 161 | const char *module_name; |
|---|
| 167 | 162 | const char *len_name; |
|---|
| 168 | | - |
|---|
| 169 | 163 | struct nvp6188_audio *audio_in; |
|---|
| 170 | 164 | struct nvp6188_audio *audio_out; |
|---|
| 171 | | - |
|---|
| 172 | 165 | int streaming; |
|---|
| 173 | | - |
|---|
| 174 | 166 | struct task_struct *detect_thread; |
|---|
| 175 | 167 | struct input_dev* input_dev; |
|---|
| 176 | 168 | unsigned char detect_status; |
|---|
| 177 | 169 | unsigned char last_detect_status; |
|---|
| 178 | 170 | u8 is_reset; |
|---|
| 171 | + bool disable_dump_register; |
|---|
| 179 | 172 | }; |
|---|
| 180 | 173 | |
|---|
| 181 | 174 | #define to_nvp6188(sd) container_of(sd, struct nvp6188, subdev) |
|---|
| .. | .. |
|---|
| 192 | 185 | struct i2c_client *client = to_i2c_client(dev); |
|---|
| 193 | 186 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
|---|
| 194 | 187 | struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 188 | + |
|---|
| 195 | 189 | return sprintf(buf, "%d\n", nvp6188->detect_status); |
|---|
| 196 | 190 | } |
|---|
| 197 | 191 | |
|---|
| 198 | | -static DEVICE_ATTR(hotplug_status, 0644, show_hotplug_status, NULL); |
|---|
| 192 | +static ssize_t nvp6188_debug_func(struct device *dev, |
|---|
| 193 | + struct device_attribute *attr, |
|---|
| 194 | + char *buf) |
|---|
| 195 | +{ |
|---|
| 196 | + struct i2c_client *client = to_i2c_client(dev); |
|---|
| 197 | + struct v4l2_subdev *sd = i2c_get_clientdata(client); |
|---|
| 198 | + struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 199 | + |
|---|
| 200 | + nvp6188->disable_dump_register = (nvp6188->disable_dump_register) ? false : true; |
|---|
| 201 | + return sprintf(buf, "switch disable_dump_register(%d)\n", nvp6188->disable_dump_register); |
|---|
| 202 | +} |
|---|
| 203 | + |
|---|
| 204 | +static DEVICE_ATTR(hotplug_status, S_IRUSR, show_hotplug_status, NULL); |
|---|
| 205 | +static DEVICE_ATTR(nvp6188_debug, S_IRUSR, nvp6188_debug_func, NULL); |
|---|
| 199 | 206 | static struct attribute *dev_attrs[] = { |
|---|
| 200 | 207 | &dev_attr_hotplug_status.attr, |
|---|
| 208 | + &dev_attr_nvp6188_debug.attr, |
|---|
| 201 | 209 | NULL, |
|---|
| 202 | 210 | }; |
|---|
| 211 | + |
|---|
| 203 | 212 | static struct attribute_group dev_attr_grp = { |
|---|
| 204 | 213 | .attrs = dev_attrs, |
|---|
| 205 | 214 | }; |
|---|
| 206 | 215 | |
|---|
| 207 | 216 | static __maybe_unused const struct regval common_setting_756M_regs[] = { |
|---|
| 208 | | - { 0xff, 0x00 }, |
|---|
| 209 | | - { 0x80, 0x0f }, |
|---|
| 210 | | - { 0x00, 0x10 }, |
|---|
| 211 | | - { 0x01, 0x10 }, |
|---|
| 212 | | - { 0x02, 0x10 }, |
|---|
| 213 | | - { 0x03, 0x10 }, |
|---|
| 214 | | - { 0x22, 0x0b }, |
|---|
| 215 | | - { 0x23, 0x41 }, |
|---|
| 216 | | - { 0x26, 0x0b }, |
|---|
| 217 | | - { 0x27, 0x41 }, |
|---|
| 218 | | - { 0x2a, 0x0b }, |
|---|
| 219 | | - { 0x2b, 0x41 }, |
|---|
| 220 | | - { 0x2e, 0x0b }, |
|---|
| 221 | | - { 0x2f, 0x41 }, |
|---|
| 217 | + {0xff, 0x00}, |
|---|
| 218 | + {0x80, 0x0f}, |
|---|
| 219 | + {0x00, 0x10}, |
|---|
| 220 | + {0x01, 0x10}, |
|---|
| 221 | + {0x02, 0x10}, |
|---|
| 222 | + {0x03, 0x10}, |
|---|
| 223 | + {0x22, 0x0b}, |
|---|
| 224 | + {0x23, 0x41}, |
|---|
| 225 | + {0x26, 0x0b}, |
|---|
| 226 | + {0x27, 0x41}, |
|---|
| 227 | + {0x2a, 0x0b}, |
|---|
| 228 | + {0x2b, 0x41}, |
|---|
| 229 | + {0x2e, 0x0b}, |
|---|
| 230 | + {0x2f, 0x41}, |
|---|
| 222 | 231 | |
|---|
| 223 | | - { 0xff, 0x01 }, |
|---|
| 224 | | - { 0x98, 0x30 }, |
|---|
| 225 | | - { 0xed, 0x00 }, |
|---|
| 232 | + {0xff, 0x01}, |
|---|
| 233 | + {0x98, 0x30}, |
|---|
| 234 | + {0xed, 0x00}, |
|---|
| 226 | 235 | |
|---|
| 227 | | - { 0xff, 0x05+0 }, |
|---|
| 228 | | - { 0x00, 0xd0 }, |
|---|
| 229 | | - { 0x01, 0x22 }, |
|---|
| 230 | | - { 0x47, 0xee }, |
|---|
| 231 | | - { 0x50, 0xc6 }, |
|---|
| 232 | | - { 0x57, 0x00 }, |
|---|
| 233 | | - { 0x58, 0x77 }, |
|---|
| 234 | | - { 0x5b, 0x41 }, |
|---|
| 235 | | - { 0x5c, 0x78 }, |
|---|
| 236 | | - { 0xB8, 0xB8 }, |
|---|
| 236 | + {0xff, 0x05 + 0}, |
|---|
| 237 | + {0x00, 0xd0}, |
|---|
| 238 | + {0x01, 0x22}, |
|---|
| 239 | + {0x47, 0xee}, |
|---|
| 240 | + {0x50, 0xc6}, |
|---|
| 241 | + {0x57, 0x00}, |
|---|
| 242 | + {0x58, 0x77}, |
|---|
| 243 | + {0x5b, 0x41}, |
|---|
| 244 | + {0x5c, 0x78}, |
|---|
| 245 | + {0xB8, 0xB8}, |
|---|
| 237 | 246 | |
|---|
| 238 | | - { 0xff, 0x05+1 }, |
|---|
| 239 | | - { 0x00, 0xd0 }, |
|---|
| 240 | | - { 0x01, 0x22 }, |
|---|
| 241 | | - { 0x47, 0xee }, |
|---|
| 242 | | - { 0x50, 0xc6 }, |
|---|
| 243 | | - { 0x57, 0x00 }, |
|---|
| 244 | | - { 0x58, 0x77 }, |
|---|
| 245 | | - { 0x5b, 0x41 }, |
|---|
| 246 | | - { 0x5c, 0x78 }, |
|---|
| 247 | | - { 0xB8, 0xB8 }, |
|---|
| 247 | + {0xff, 0x05 + 1}, |
|---|
| 248 | + {0x00, 0xd0}, |
|---|
| 249 | + {0x01, 0x22}, |
|---|
| 250 | + {0x47, 0xee}, |
|---|
| 251 | + {0x50, 0xc6}, |
|---|
| 252 | + {0x57, 0x00}, |
|---|
| 253 | + {0x58, 0x77}, |
|---|
| 254 | + {0x5b, 0x41}, |
|---|
| 255 | + {0x5c, 0x78}, |
|---|
| 256 | + {0xB8, 0xB8}, |
|---|
| 248 | 257 | |
|---|
| 249 | | - { 0xff, 0x05+2 }, |
|---|
| 250 | | - { 0x00, 0xd0 }, |
|---|
| 251 | | - { 0x01, 0x22 }, |
|---|
| 252 | | - { 0x47, 0xee }, |
|---|
| 253 | | - { 0x50, 0xc6 }, |
|---|
| 254 | | - { 0x57, 0x00 }, |
|---|
| 255 | | - { 0x58, 0x77 }, |
|---|
| 256 | | - { 0x5b, 0x41 }, |
|---|
| 257 | | - { 0x5c, 0x78 }, |
|---|
| 258 | | - { 0xB8, 0xB8 }, |
|---|
| 258 | + {0xff, 0x05 + 2}, |
|---|
| 259 | + {0x00, 0xd0}, |
|---|
| 260 | + {0x01, 0x22}, |
|---|
| 261 | + {0x47, 0xee}, |
|---|
| 262 | + {0x50, 0xc6}, |
|---|
| 263 | + {0x57, 0x00}, |
|---|
| 264 | + {0x58, 0x77}, |
|---|
| 265 | + {0x5b, 0x41}, |
|---|
| 266 | + {0x5c, 0x78}, |
|---|
| 267 | + {0xB8, 0xB8}, |
|---|
| 259 | 268 | |
|---|
| 260 | | - { 0xff, 0x05+3 }, |
|---|
| 261 | | - { 0x00, 0xd0 }, |
|---|
| 262 | | - { 0x01, 0x22 }, |
|---|
| 263 | | - { 0x47, 0xee }, |
|---|
| 264 | | - { 0x50, 0xc6 }, |
|---|
| 265 | | - { 0x57, 0x00 }, |
|---|
| 266 | | - { 0x58, 0x77 }, |
|---|
| 267 | | - { 0x5b, 0x41 }, |
|---|
| 268 | | - { 0x5c, 0x78 }, |
|---|
| 269 | | - { 0xB8, 0xB8 }, |
|---|
| 269 | + {0xff, 0x05 + 3}, |
|---|
| 270 | + {0x00, 0xd0}, |
|---|
| 271 | + {0x01, 0x22}, |
|---|
| 272 | + {0x47, 0xee}, |
|---|
| 273 | + {0x50, 0xc6}, |
|---|
| 274 | + {0x57, 0x00}, |
|---|
| 275 | + {0x58, 0x77}, |
|---|
| 276 | + {0x5b, 0x41}, |
|---|
| 277 | + {0x5c, 0x78}, |
|---|
| 278 | + {0xB8, 0xB8}, |
|---|
| 270 | 279 | |
|---|
| 271 | | - { 0xff, 0x09 }, |
|---|
| 272 | | - { 0x50, 0x30 }, |
|---|
| 273 | | - { 0x51, 0x6f }, |
|---|
| 274 | | - { 0x52, 0x67 }, |
|---|
| 275 | | - { 0x53, 0x48 }, |
|---|
| 276 | | - { 0x54, 0x30 }, |
|---|
| 277 | | - { 0x55, 0x6f }, |
|---|
| 278 | | - { 0x56, 0x67 }, |
|---|
| 279 | | - { 0x57, 0x48 }, |
|---|
| 280 | | - { 0x58, 0x30 }, |
|---|
| 281 | | - { 0x59, 0x6f }, |
|---|
| 282 | | - { 0x5a, 0x67 }, |
|---|
| 283 | | - { 0x5b, 0x48 }, |
|---|
| 284 | | - { 0x5c, 0x30 }, |
|---|
| 285 | | - { 0x5d, 0x6f }, |
|---|
| 286 | | - { 0x5e, 0x67 }, |
|---|
| 287 | | - { 0x5f, 0x48 }, |
|---|
| 280 | + {0xff, 0x09}, |
|---|
| 281 | + {0x50, 0x30}, |
|---|
| 282 | + {0x51, 0x6f}, |
|---|
| 283 | + {0x52, 0x67}, |
|---|
| 284 | + {0x53, 0x48}, |
|---|
| 285 | + {0x54, 0x30}, |
|---|
| 286 | + {0x55, 0x6f}, |
|---|
| 287 | + {0x56, 0x67}, |
|---|
| 288 | + {0x57, 0x48}, |
|---|
| 289 | + {0x58, 0x30}, |
|---|
| 290 | + {0x59, 0x6f}, |
|---|
| 291 | + {0x5a, 0x67}, |
|---|
| 292 | + {0x5b, 0x48}, |
|---|
| 293 | + {0x5c, 0x30}, |
|---|
| 294 | + {0x5d, 0x6f}, |
|---|
| 295 | + {0x5e, 0x67}, |
|---|
| 296 | + {0x5f, 0x48}, |
|---|
| 288 | 297 | |
|---|
| 289 | | - { 0xff, 0x0a }, |
|---|
| 290 | | - { 0x25, 0x10 }, |
|---|
| 291 | | - { 0x27, 0x1e }, |
|---|
| 292 | | - { 0x30, 0xac }, |
|---|
| 293 | | - { 0x31, 0x78 }, |
|---|
| 294 | | - { 0x32, 0x17 }, |
|---|
| 295 | | - { 0x33, 0xc1 }, |
|---|
| 296 | | - { 0x34, 0x40 }, |
|---|
| 297 | | - { 0x35, 0x00 }, |
|---|
| 298 | | - { 0x36, 0xc3 }, |
|---|
| 299 | | - { 0x37, 0x0a }, |
|---|
| 300 | | - { 0x38, 0x00 }, |
|---|
| 301 | | - { 0x39, 0x02 }, |
|---|
| 302 | | - { 0x3a, 0x00 }, |
|---|
| 303 | | - { 0x3b, 0xb2 }, |
|---|
| 304 | | - { 0xa5, 0x10 }, |
|---|
| 305 | | - { 0xa7, 0x1e }, |
|---|
| 306 | | - { 0xb0, 0xac }, |
|---|
| 307 | | - { 0xb1, 0x78 }, |
|---|
| 308 | | - { 0xb2, 0x17 }, |
|---|
| 309 | | - { 0xb3, 0xc1 }, |
|---|
| 310 | | - { 0xb4, 0x40 }, |
|---|
| 311 | | - { 0xb5, 0x00 }, |
|---|
| 312 | | - { 0xb6, 0xc3 }, |
|---|
| 313 | | - { 0xb7, 0x0a }, |
|---|
| 314 | | - { 0xb8, 0x00 }, |
|---|
| 315 | | - { 0xb9, 0x02 }, |
|---|
| 316 | | - { 0xba, 0x00 }, |
|---|
| 317 | | - { 0xbb, 0xb2 }, |
|---|
| 318 | | - { 0xff, 0x0b }, |
|---|
| 319 | | - { 0x25, 0x10 }, |
|---|
| 320 | | - { 0x27, 0x1e }, |
|---|
| 321 | | - { 0x30, 0xac }, |
|---|
| 322 | | - { 0x31, 0x78 }, |
|---|
| 323 | | - { 0x32, 0x17 }, |
|---|
| 324 | | - { 0x33, 0xc1 }, |
|---|
| 325 | | - { 0x34, 0x40 }, |
|---|
| 326 | | - { 0x35, 0x00 }, |
|---|
| 327 | | - { 0x36, 0xc3 }, |
|---|
| 328 | | - { 0x37, 0x0a }, |
|---|
| 329 | | - { 0x38, 0x00 }, |
|---|
| 330 | | - { 0x39, 0x02 }, |
|---|
| 331 | | - { 0x3a, 0x00 }, |
|---|
| 332 | | - { 0x3b, 0xb2 }, |
|---|
| 333 | | - { 0xa5, 0x10 }, |
|---|
| 334 | | - { 0xa7, 0x1e }, |
|---|
| 335 | | - { 0xb0, 0xac }, |
|---|
| 336 | | - { 0xb1, 0x78 }, |
|---|
| 337 | | - { 0xb2, 0x17 }, |
|---|
| 338 | | - { 0xb3, 0xc1 }, |
|---|
| 339 | | - { 0xb4, 0x40 }, |
|---|
| 340 | | - { 0xb5, 0x00 }, |
|---|
| 341 | | - { 0xb6, 0xc3 }, |
|---|
| 342 | | - { 0xb7, 0x0a }, |
|---|
| 343 | | - { 0xb8, 0x00 }, |
|---|
| 344 | | - { 0xb9, 0x02 }, |
|---|
| 345 | | - { 0xba, 0x00 }, |
|---|
| 346 | | - { 0xbb, 0xb2 }, |
|---|
| 298 | + {0xff, 0x0a}, |
|---|
| 299 | + {0x25, 0x10}, |
|---|
| 300 | + {0x27, 0x1e}, |
|---|
| 301 | + {0x30, 0xac}, |
|---|
| 302 | + {0x31, 0x78}, |
|---|
| 303 | + {0x32, 0x17}, |
|---|
| 304 | + {0x33, 0xc1}, |
|---|
| 305 | + {0x34, 0x40}, |
|---|
| 306 | + {0x35, 0x00}, |
|---|
| 307 | + {0x36, 0xc3}, |
|---|
| 308 | + {0x37, 0x0a}, |
|---|
| 309 | + {0x38, 0x00}, |
|---|
| 310 | + {0x39, 0x02}, |
|---|
| 311 | + {0x3a, 0x00}, |
|---|
| 312 | + {0x3b, 0xb2}, |
|---|
| 313 | + {0xa5, 0x10}, |
|---|
| 314 | + {0xa7, 0x1e}, |
|---|
| 315 | + {0xb0, 0xac}, |
|---|
| 316 | + {0xb1, 0x78}, |
|---|
| 317 | + {0xb2, 0x17}, |
|---|
| 318 | + {0xb3, 0xc1}, |
|---|
| 319 | + {0xb4, 0x40}, |
|---|
| 320 | + {0xb5, 0x00}, |
|---|
| 321 | + {0xb6, 0xc3}, |
|---|
| 322 | + {0xb7, 0x0a}, |
|---|
| 323 | + {0xb8, 0x00}, |
|---|
| 324 | + {0xb9, 0x02}, |
|---|
| 325 | + {0xba, 0x00}, |
|---|
| 326 | + {0xbb, 0xb2}, |
|---|
| 327 | + {0xff, 0x0b}, |
|---|
| 328 | + {0x25, 0x10}, |
|---|
| 329 | + {0x27, 0x1e}, |
|---|
| 330 | + {0x30, 0xac}, |
|---|
| 331 | + {0x31, 0x78}, |
|---|
| 332 | + {0x32, 0x17}, |
|---|
| 333 | + {0x33, 0xc1}, |
|---|
| 334 | + {0x34, 0x40}, |
|---|
| 335 | + {0x35, 0x00}, |
|---|
| 336 | + {0x36, 0xc3}, |
|---|
| 337 | + {0x37, 0x0a}, |
|---|
| 338 | + {0x38, 0x00}, |
|---|
| 339 | + {0x39, 0x02}, |
|---|
| 340 | + {0x3a, 0x00}, |
|---|
| 341 | + {0x3b, 0xb2}, |
|---|
| 342 | + {0xa5, 0x10}, |
|---|
| 343 | + {0xa7, 0x1e}, |
|---|
| 344 | + {0xb0, 0xac}, |
|---|
| 345 | + {0xb1, 0x78}, |
|---|
| 346 | + {0xb2, 0x17}, |
|---|
| 347 | + {0xb3, 0xc1}, |
|---|
| 348 | + {0xb4, 0x40}, |
|---|
| 349 | + {0xb5, 0x00}, |
|---|
| 350 | + {0xb6, 0xc3}, |
|---|
| 351 | + {0xb7, 0x0a}, |
|---|
| 352 | + {0xb8, 0x00}, |
|---|
| 353 | + {0xb9, 0x02}, |
|---|
| 354 | + {0xba, 0x00}, |
|---|
| 355 | + {0xbb, 0xb2}, |
|---|
| 347 | 356 | |
|---|
| 348 | | - { 0xff, 0x13 }, |
|---|
| 349 | | - { 0x05, 0xa0 }, |
|---|
| 350 | | - { 0x31, 0xff }, |
|---|
| 351 | | - { 0x07, 0x47 }, |
|---|
| 352 | | - { 0x12, 0x04 }, |
|---|
| 353 | | - { 0x1e, 0x1f }, |
|---|
| 354 | | - { 0x1f, 0x27 }, |
|---|
| 355 | | - { 0x2e, 0x10 }, |
|---|
| 356 | | - { 0x2f, 0xc8 }, |
|---|
| 357 | | - { 0x31, 0xff }, |
|---|
| 358 | | - { 0x32, 0x00 }, |
|---|
| 359 | | - { 0x33, 0x00 }, |
|---|
| 360 | | - { 0x72, 0x05 }, |
|---|
| 361 | | - { 0x7a, 0xf0 }, |
|---|
| 362 | | - { 0xff, _MAR_BANK_ }, |
|---|
| 363 | | - { 0x10, 0xff }, |
|---|
| 364 | | - { 0x11, 0xff }, |
|---|
| 357 | + {0xff, 0x13}, |
|---|
| 358 | + {0x05, 0xa0}, |
|---|
| 359 | + {0x31, 0xff}, |
|---|
| 360 | + {0x07, 0x47}, |
|---|
| 361 | + {0x12, 0x04}, |
|---|
| 362 | + {0x1e, 0x1f}, |
|---|
| 363 | + {0x1f, 0x27}, |
|---|
| 364 | + {0x2e, 0x10}, |
|---|
| 365 | + {0x2f, 0xc8}, |
|---|
| 366 | + {0x31, 0xff}, |
|---|
| 367 | + {0x32, 0x00}, |
|---|
| 368 | + {0x33, 0x00}, |
|---|
| 369 | + {0x72, 0x05}, |
|---|
| 370 | + {0x7a, 0xf0}, |
|---|
| 371 | + {0xff, _MAR_BANK_}, |
|---|
| 372 | + {0x10, 0xff}, |
|---|
| 373 | + {0x11, 0xff}, |
|---|
| 365 | 374 | |
|---|
| 366 | | - { 0x30, 0x0f }, |
|---|
| 367 | | - { 0x32, 0x92 }, |
|---|
| 368 | | - { 0x34, 0xcd }, |
|---|
| 369 | | - { 0x36, 0x04 }, |
|---|
| 370 | | - { 0x38, 0x58 }, |
|---|
| 375 | + {0x30, 0x0f}, |
|---|
| 376 | + {0x32, 0x92}, |
|---|
| 377 | + {0x34, 0xcd}, |
|---|
| 378 | + {0x36, 0x04}, |
|---|
| 379 | + {0x38, 0x58}, |
|---|
| 371 | 380 | |
|---|
| 372 | | - { 0x3c, 0x01 }, |
|---|
| 373 | | - { 0x3d, 0x11 }, |
|---|
| 374 | | - { 0x3e, 0x11 }, |
|---|
| 375 | | - { 0x45, 0x60 }, |
|---|
| 376 | | - { 0x46, 0x49 }, |
|---|
| 381 | + {0x3c, 0x01}, |
|---|
| 382 | + {0x3d, 0x11}, |
|---|
| 383 | + {0x3e, 0x11}, |
|---|
| 384 | + {0x45, 0x60}, |
|---|
| 385 | + {0x46, 0x49}, |
|---|
| 377 | 386 | |
|---|
| 378 | | - { 0xff, _MTX_BANK_ }, |
|---|
| 379 | | - { 0xe9, 0x03 }, |
|---|
| 380 | | - { 0x03, 0x02 }, |
|---|
| 381 | | - { 0x01, 0xe0 }, |
|---|
| 382 | | - { 0x00, 0x7d }, |
|---|
| 383 | | - { 0x01, 0xe0 }, |
|---|
| 384 | | - { 0x02, 0xa0 }, |
|---|
| 385 | | - { 0x20, 0x1e }, |
|---|
| 386 | | - { 0x20, 0x1f }, |
|---|
| 387 | + {0xff, _MTX_BANK_}, |
|---|
| 388 | + {0xe9, 0x03}, |
|---|
| 389 | + {0x03, 0x02}, |
|---|
| 390 | + {0x01, 0xe0}, |
|---|
| 391 | + {0x00, 0x7d}, |
|---|
| 392 | + {0x01, 0xe0}, |
|---|
| 393 | + {0x02, 0xa0}, |
|---|
| 394 | + {0x20, 0x1e}, |
|---|
| 395 | + {0x20, 0x1f}, |
|---|
| 387 | 396 | |
|---|
| 388 | | - { 0x04, 0x38 }, |
|---|
| 389 | | - { 0x45, 0xc4 }, |
|---|
| 390 | | - { 0x46, 0x01 }, |
|---|
| 391 | | - { 0x47, 0x1b }, |
|---|
| 392 | | - { 0x48, 0x08 }, |
|---|
| 393 | | - { 0x65, 0xc4 }, |
|---|
| 394 | | - { 0x66, 0x01 }, |
|---|
| 395 | | - { 0x67, 0x1b }, |
|---|
| 396 | | - { 0x68, 0x08 }, |
|---|
| 397 | | - { 0x85, 0xc4 }, |
|---|
| 398 | | - { 0x86, 0x01 }, |
|---|
| 399 | | - { 0x87, 0x1b }, |
|---|
| 400 | | - { 0x88, 0x08 }, |
|---|
| 401 | | - { 0xa5, 0xc4 }, |
|---|
| 402 | | - { 0xa6, 0x01 }, |
|---|
| 403 | | - { 0xa7, 0x1b }, |
|---|
| 404 | | - { 0xa8, 0x08 }, |
|---|
| 405 | | - { 0xc5, 0xc4 }, |
|---|
| 406 | | - { 0xc6, 0x01 }, |
|---|
| 407 | | - { 0xc7, 0x1b }, |
|---|
| 408 | | - { 0xc8, 0x08 }, |
|---|
| 409 | | - { 0xeb, 0x8d }, |
|---|
| 397 | + {0x04, 0x38}, |
|---|
| 398 | + {0x45, 0xc4}, |
|---|
| 399 | + {0x46, 0x01}, |
|---|
| 400 | + {0x47, 0x1b}, |
|---|
| 401 | + {0x48, 0x08}, |
|---|
| 402 | + {0x65, 0xc4}, |
|---|
| 403 | + {0x66, 0x01}, |
|---|
| 404 | + {0x67, 0x1b}, |
|---|
| 405 | + {0x68, 0x08}, |
|---|
| 406 | + {0x85, 0xc4}, |
|---|
| 407 | + {0x86, 0x01}, |
|---|
| 408 | + {0x87, 0x1b}, |
|---|
| 409 | + {0x88, 0x08}, |
|---|
| 410 | + {0xa5, 0xc4}, |
|---|
| 411 | + {0xa6, 0x01}, |
|---|
| 412 | + {0xa7, 0x1b}, |
|---|
| 413 | + {0xa8, 0x08}, |
|---|
| 414 | + {0xc5, 0xc4}, |
|---|
| 415 | + {0xc6, 0x01}, |
|---|
| 416 | + {0xc7, 0x1b}, |
|---|
| 417 | + {0xc8, 0x08}, |
|---|
| 418 | + {0xeb, 0x8d}, |
|---|
| 410 | 419 | |
|---|
| 411 | | - { 0xff, _MAR_BANK_ }, |
|---|
| 412 | | - { 0x00, 0xff }, |
|---|
| 413 | | - { 0x40, 0x01 }, |
|---|
| 414 | | - { 0x40, 0x00 }, |
|---|
| 415 | | - { 0xff, 0x01 }, |
|---|
| 416 | | - { 0x97, 0x00 }, |
|---|
| 417 | | - { 0x97, 0x0f }, |
|---|
| 420 | + {0xff, _MAR_BANK_}, |
|---|
| 421 | + {0x00, 0xff}, |
|---|
| 422 | + {0x40, 0x01}, |
|---|
| 423 | + {0x40, 0x00}, |
|---|
| 424 | + {0xff, 0x01}, |
|---|
| 425 | + {0x97, 0x00}, |
|---|
| 426 | + {0x97, 0x0f}, |
|---|
| 418 | 427 | |
|---|
| 419 | | - { 0xff, 0x00 }, //test pattern |
|---|
| 420 | | - { 0x78, 0xba }, |
|---|
| 421 | | - { 0x79, 0xac }, |
|---|
| 422 | | - { 0xff, 0x05 }, |
|---|
| 423 | | - { 0x2c, 0x08 }, |
|---|
| 424 | | - { 0x6a, 0x80 }, |
|---|
| 425 | | - { 0xff, 0x06 }, |
|---|
| 426 | | - { 0x2c, 0x08 }, |
|---|
| 427 | | - { 0x6a, 0x80 }, |
|---|
| 428 | | - { 0xff, 0x07 }, |
|---|
| 429 | | - { 0x2c, 0x08 }, |
|---|
| 430 | | - { 0x6a, 0x80 }, |
|---|
| 431 | | - { 0xff, 0x08 }, |
|---|
| 432 | | - { 0x2c, 0x08 }, |
|---|
| 433 | | - { 0x6a, 0x80 }, |
|---|
| 428 | + {0xff, 0x00}, //test pattern |
|---|
| 429 | + {0x78, 0xba}, |
|---|
| 430 | + {0x79, 0xac}, |
|---|
| 431 | + {0xff, 0x05}, |
|---|
| 432 | + {0x2c, 0x08}, |
|---|
| 433 | + {0x6a, 0x80}, |
|---|
| 434 | + {0xff, 0x06}, |
|---|
| 435 | + {0x2c, 0x08}, |
|---|
| 436 | + {0x6a, 0x80}, |
|---|
| 437 | + {0xff, 0x07}, |
|---|
| 438 | + {0x2c, 0x08}, |
|---|
| 439 | + {0x6a, 0x80}, |
|---|
| 440 | + {0xff, 0x08}, |
|---|
| 441 | + {0x2c, 0x08}, |
|---|
| 442 | + {0x6a, 0x80}, |
|---|
| 434 | 443 | }; |
|---|
| 435 | 444 | |
|---|
| 436 | 445 | static __maybe_unused const struct regval common_setting_1458M_regs[] = { |
|---|
| 437 | | - { 0xff, 0x00 }, |
|---|
| 438 | | - { 0x80, 0x0f }, |
|---|
| 439 | | - { 0x00, 0x10 }, |
|---|
| 440 | | - { 0x01, 0x10 }, |
|---|
| 441 | | - { 0x02, 0x10 }, |
|---|
| 442 | | - { 0x03, 0x10 }, |
|---|
| 443 | | - { 0x22, 0x0b }, |
|---|
| 444 | | - { 0x23, 0x41 }, |
|---|
| 445 | | - { 0x26, 0x0b }, |
|---|
| 446 | | - { 0x27, 0x41 }, |
|---|
| 447 | | - { 0x2a, 0x0b }, |
|---|
| 448 | | - { 0x2b, 0x41 }, |
|---|
| 449 | | - { 0x2e, 0x0b }, |
|---|
| 450 | | - { 0x2f, 0x41 }, |
|---|
| 446 | + {0xff, 0x01}, |
|---|
| 447 | + {0x80, 0x40}, |
|---|
| 448 | + {0x98, 0x30}, |
|---|
| 449 | + {0x7a, 0x00}, |
|---|
| 450 | + {0xff, _MTX_BANK_}, |
|---|
| 451 | + {0xe9, 0x03}, |
|---|
| 452 | + {0x03, 0x02}, |
|---|
| 453 | + {0x04, 0x6c}, |
|---|
| 454 | + {0x08, 0x4f}, |
|---|
| 455 | + {0x01, 0xe4}, |
|---|
| 456 | + {0x00, 0x7d}, |
|---|
| 457 | + {0x01, 0xe0}, |
|---|
| 458 | + {0x20, 0x1e}, |
|---|
| 459 | + {0x20, 0x1f}, |
|---|
| 460 | + {0xeb, 0x8d}, |
|---|
| 461 | + {0x45, 0xcd}, |
|---|
| 462 | + {0x46, 0x42}, |
|---|
| 463 | + {0x47, 0x36}, |
|---|
| 464 | + {0x48, 0x0f}, |
|---|
| 465 | + {0x65, 0xcd}, |
|---|
| 466 | + {0x66, 0x42}, |
|---|
| 467 | + {0x67, 0x0e}, |
|---|
| 468 | + {0x68, 0x0f}, |
|---|
| 469 | + {0x85, 0xcd}, |
|---|
| 470 | + {0x86, 0x42}, |
|---|
| 471 | + {0x87, 0x0e}, |
|---|
| 472 | + {0x88, 0x0f}, |
|---|
| 473 | + {0xa5, 0xcd}, |
|---|
| 474 | + {0xa6, 0x42}, |
|---|
| 475 | + {0xa7, 0x0e}, |
|---|
| 476 | + {0xa8, 0x0f}, |
|---|
| 477 | + {0xc5, 0xcd}, |
|---|
| 478 | + {0xc6, 0x42}, |
|---|
| 479 | + {0xc7, 0x0e}, |
|---|
| 480 | + {0xc8, 0x0f}, |
|---|
| 451 | 481 | |
|---|
| 452 | | - { 0xff, 0x01 }, |
|---|
| 453 | | - { 0x98, 0x30 }, |
|---|
| 454 | | - { 0xed, 0x00 }, |
|---|
| 482 | + {0xff, 0x05 + 0}, |
|---|
| 483 | + {0x01, 0x62}, |
|---|
| 484 | + {0x05, 0x04}, |
|---|
| 485 | + {0x08, 0x55}, |
|---|
| 486 | + {0x1b, 0x08}, |
|---|
| 487 | + {0x25, 0xdc}, |
|---|
| 488 | + {0x28, 0x80}, |
|---|
| 489 | + {0x2f, 0x00}, |
|---|
| 490 | + {0x30, 0xe0}, |
|---|
| 491 | + {0x31, 0x43}, |
|---|
| 492 | + {0x32, 0xa2}, |
|---|
| 493 | + {0x57, 0x00}, |
|---|
| 494 | + {0x58, 0x77}, |
|---|
| 495 | + {0x5b, 0x41}, |
|---|
| 496 | + {0x5c, 0x78}, |
|---|
| 497 | + {0x5f, 0x00}, |
|---|
| 498 | + {0x7b, 0x11}, |
|---|
| 499 | + {0x7c, 0x01}, |
|---|
| 500 | + {0x7d, 0x80}, |
|---|
| 501 | + {0x80, 0x00}, |
|---|
| 502 | + {0x90, 0x01}, |
|---|
| 503 | + {0xa9, 0x00}, |
|---|
| 504 | + {0xb5, 0x00}, |
|---|
| 505 | + {0xb9, 0x72}, |
|---|
| 506 | + {0xd1, 0x00}, |
|---|
| 507 | + {0xd5, 0x80}, |
|---|
| 455 | 508 | |
|---|
| 456 | | - { 0xff, 0x05+0 }, |
|---|
| 457 | | - { 0x00, 0xd0 }, |
|---|
| 458 | | - { 0x01, 0x22 }, |
|---|
| 459 | | - { 0x47, 0xee }, |
|---|
| 460 | | - { 0x50, 0xc6 }, |
|---|
| 461 | | - { 0x57, 0x00 }, |
|---|
| 462 | | - { 0x58, 0x77 }, |
|---|
| 463 | | - { 0x5b, 0x41 }, |
|---|
| 464 | | - { 0x5c, 0x78 }, |
|---|
| 465 | | - { 0xB8, 0xB8 }, |
|---|
| 509 | + {0xff, 0x05 + 1}, |
|---|
| 510 | + {0x01, 0x62}, |
|---|
| 511 | + {0x05, 0x04}, |
|---|
| 512 | + {0x08, 0x55}, |
|---|
| 513 | + {0x1b, 0x08}, |
|---|
| 514 | + {0x25, 0xdc}, |
|---|
| 515 | + {0x28, 0x80}, |
|---|
| 516 | + {0x2f, 0x00}, |
|---|
| 517 | + {0x30, 0xe0}, |
|---|
| 518 | + {0x31, 0x43}, |
|---|
| 519 | + {0x32, 0xa2}, |
|---|
| 520 | + {0x57, 0x00}, |
|---|
| 521 | + {0x58, 0x77}, |
|---|
| 522 | + {0x5b, 0x41}, |
|---|
| 523 | + {0x5c, 0x78}, |
|---|
| 524 | + {0x5f, 0x00}, |
|---|
| 525 | + {0x7b, 0x11}, |
|---|
| 526 | + {0x7c, 0x01}, |
|---|
| 527 | + {0x7d, 0x80}, |
|---|
| 528 | + {0x80, 0x00}, |
|---|
| 529 | + {0x90, 0x01}, |
|---|
| 530 | + {0xa9, 0x00}, |
|---|
| 531 | + {0xb5, 0x00}, |
|---|
| 532 | + {0xb9, 0x72}, |
|---|
| 533 | + {0xd1, 0x00}, |
|---|
| 534 | + {0xd5, 0x80}, |
|---|
| 466 | 535 | |
|---|
| 467 | | - { 0xff, 0x05+1 }, |
|---|
| 468 | | - { 0x00, 0xd0 }, |
|---|
| 469 | | - { 0x01, 0x22 }, |
|---|
| 470 | | - { 0x47, 0xee }, |
|---|
| 471 | | - { 0x50, 0xc6 }, |
|---|
| 472 | | - { 0x57, 0x00 }, |
|---|
| 473 | | - { 0x58, 0x77 }, |
|---|
| 474 | | - { 0x5b, 0x41 }, |
|---|
| 475 | | - { 0x5c, 0x78 }, |
|---|
| 476 | | - { 0xB8, 0xB8 }, |
|---|
| 536 | + {0xff, 0x05 + 2}, |
|---|
| 537 | + {0x01, 0x62}, |
|---|
| 538 | + {0x05, 0x04}, |
|---|
| 539 | + {0x08, 0x55}, |
|---|
| 540 | + {0x1b, 0x08}, |
|---|
| 541 | + {0x25, 0xdc}, |
|---|
| 542 | + {0x28, 0x80}, |
|---|
| 543 | + {0x2f, 0x00}, |
|---|
| 544 | + {0x30, 0xe0}, |
|---|
| 545 | + {0x31, 0x43}, |
|---|
| 546 | + {0x32, 0xa2}, |
|---|
| 547 | + {0x57, 0x00}, |
|---|
| 548 | + {0x58, 0x77}, |
|---|
| 549 | + {0x5b, 0x41}, |
|---|
| 550 | + {0x5c, 0x78}, |
|---|
| 551 | + {0x5f, 0x00}, |
|---|
| 552 | + {0x7b, 0x11}, |
|---|
| 553 | + {0x7c, 0x01}, |
|---|
| 554 | + {0x7d, 0x80}, |
|---|
| 555 | + {0x80, 0x00}, |
|---|
| 556 | + {0x90, 0x01}, |
|---|
| 557 | + {0xa9, 0x00}, |
|---|
| 558 | + {0xb5, 0x00}, |
|---|
| 559 | + {0xb9, 0x72}, |
|---|
| 560 | + {0xd1, 0x00}, |
|---|
| 561 | + {0xd5, 0x80}, |
|---|
| 477 | 562 | |
|---|
| 478 | | - { 0xff, 0x05+2 }, |
|---|
| 479 | | - { 0x00, 0xd0 }, |
|---|
| 480 | | - { 0x01, 0x22 }, |
|---|
| 481 | | - { 0x47, 0xee }, |
|---|
| 482 | | - { 0x50, 0xc6 }, |
|---|
| 483 | | - { 0x57, 0x00 }, |
|---|
| 484 | | - { 0x58, 0x77 }, |
|---|
| 485 | | - { 0x5b, 0x41 }, |
|---|
| 486 | | - { 0x5c, 0x78 }, |
|---|
| 487 | | - { 0xB8, 0xB8 }, |
|---|
| 563 | + {0xff, 0x05 + 3}, |
|---|
| 564 | + {0x01, 0x62}, |
|---|
| 565 | + {0x05, 0x04}, |
|---|
| 566 | + {0x08, 0x55}, |
|---|
| 567 | + {0x1b, 0x08}, |
|---|
| 568 | + {0x25, 0xdc}, |
|---|
| 569 | + {0x28, 0x80}, |
|---|
| 570 | + {0x2f, 0x00}, |
|---|
| 571 | + {0x30, 0xe0}, |
|---|
| 572 | + {0x31, 0x43}, |
|---|
| 573 | + {0x32, 0xa2}, |
|---|
| 574 | + {0x57, 0x00}, |
|---|
| 575 | + {0x58, 0x77}, |
|---|
| 576 | + {0x5b, 0x41}, |
|---|
| 577 | + {0x5c, 0x78}, |
|---|
| 578 | + {0x5f, 0x00}, |
|---|
| 579 | + {0x7b, 0x11}, |
|---|
| 580 | + {0x7c, 0x01}, |
|---|
| 581 | + {0x7d, 0x80}, |
|---|
| 582 | + {0x80, 0x00}, |
|---|
| 583 | + {0x90, 0x01}, |
|---|
| 584 | + {0xa9, 0x00}, |
|---|
| 585 | + {0xb5, 0x00}, |
|---|
| 586 | + {0xb9, 0x72}, |
|---|
| 587 | + {0xd1, 0x00}, |
|---|
| 588 | + {0xd5, 0x80}, |
|---|
| 488 | 589 | |
|---|
| 489 | | - { 0xff, 0x05+3 }, |
|---|
| 490 | | - { 0x00, 0xd0 }, |
|---|
| 491 | | - { 0x01, 0x22 }, |
|---|
| 492 | | - { 0x47, 0xee }, |
|---|
| 493 | | - { 0x50, 0xc6 }, |
|---|
| 494 | | - { 0x57, 0x00 }, |
|---|
| 495 | | - { 0x58, 0x77 }, |
|---|
| 496 | | - { 0x5b, 0x41 }, |
|---|
| 497 | | - { 0x5c, 0x78 }, |
|---|
| 498 | | - { 0xB8, 0xB8 }, |
|---|
| 590 | + {0xff, 0x09}, |
|---|
| 591 | + {0x50, 0x30}, |
|---|
| 592 | + {0x51, 0x6f}, |
|---|
| 593 | + {0x52, 0x67}, |
|---|
| 594 | + {0x53, 0x48}, |
|---|
| 595 | + {0x54, 0x30}, |
|---|
| 596 | + {0x55, 0x6f}, |
|---|
| 597 | + {0x56, 0x67}, |
|---|
| 598 | + {0x57, 0x48}, |
|---|
| 599 | + {0x58, 0x30}, |
|---|
| 600 | + {0x59, 0x6f}, |
|---|
| 601 | + {0x5a, 0x67}, |
|---|
| 602 | + {0x5b, 0x48}, |
|---|
| 603 | + {0x5c, 0x30}, |
|---|
| 604 | + {0x5d, 0x6f}, |
|---|
| 605 | + {0x5e, 0x67}, |
|---|
| 606 | + {0x5f, 0x48}, |
|---|
| 607 | + {0x96, 0x03}, |
|---|
| 608 | + {0xb6, 0x03}, |
|---|
| 609 | + {0xd6, 0x03}, |
|---|
| 610 | + {0xf6, 0x03}, |
|---|
| 499 | 611 | |
|---|
| 500 | | - { 0xff, 0x09 }, |
|---|
| 501 | | - { 0x50, 0x30 }, |
|---|
| 502 | | - { 0x51, 0x6f }, |
|---|
| 503 | | - { 0x52, 0x67 }, |
|---|
| 504 | | - { 0x53, 0x48 }, |
|---|
| 505 | | - { 0x54, 0x30 }, |
|---|
| 506 | | - { 0x55, 0x6f }, |
|---|
| 507 | | - { 0x56, 0x67 }, |
|---|
| 508 | | - { 0x57, 0x48 }, |
|---|
| 509 | | - { 0x58, 0x30 }, |
|---|
| 510 | | - { 0x59, 0x6f }, |
|---|
| 511 | | - { 0x5a, 0x67 }, |
|---|
| 512 | | - { 0x5b, 0x48 }, |
|---|
| 513 | | - { 0x5c, 0x30 }, |
|---|
| 514 | | - { 0x5d, 0x6f }, |
|---|
| 515 | | - { 0x5e, 0x67 }, |
|---|
| 516 | | - { 0x5f, 0x48 }, |
|---|
| 612 | + {0xff, 0x0a}, |
|---|
| 613 | + {0x25, 0x10}, |
|---|
| 614 | + {0x27, 0x1e}, |
|---|
| 615 | + {0x30, 0xac}, |
|---|
| 616 | + {0x31, 0x78}, |
|---|
| 617 | + {0x32, 0x17}, |
|---|
| 618 | + {0x33, 0xc1}, |
|---|
| 619 | + {0x34, 0x40}, |
|---|
| 620 | + {0x35, 0x00}, |
|---|
| 621 | + {0x36, 0xc3}, |
|---|
| 622 | + {0x37, 0x0a}, |
|---|
| 623 | + {0x38, 0x00}, |
|---|
| 624 | + {0x39, 0x02}, |
|---|
| 625 | + {0x3a, 0x00}, |
|---|
| 626 | + {0x3b, 0xb2}, |
|---|
| 627 | + {0xa5, 0x10}, |
|---|
| 628 | + {0xa7, 0x1e}, |
|---|
| 629 | + {0xb0, 0xac}, |
|---|
| 630 | + {0xb1, 0x78}, |
|---|
| 631 | + {0xb2, 0x17}, |
|---|
| 632 | + {0xb3, 0xc1}, |
|---|
| 633 | + {0xb4, 0x40}, |
|---|
| 634 | + {0xb5, 0x00}, |
|---|
| 635 | + {0xb6, 0xc3}, |
|---|
| 636 | + {0xb7, 0x0a}, |
|---|
| 637 | + {0xb8, 0x00}, |
|---|
| 638 | + {0xb9, 0x02}, |
|---|
| 639 | + {0xba, 0x00}, |
|---|
| 640 | + {0xbb, 0xb2}, |
|---|
| 641 | + {0xff, 0x0b}, |
|---|
| 642 | + {0x25, 0x10}, |
|---|
| 643 | + {0x27, 0x1e}, |
|---|
| 644 | + {0x30, 0xac}, |
|---|
| 645 | + {0x31, 0x78}, |
|---|
| 646 | + {0x32, 0x17}, |
|---|
| 647 | + {0x33, 0xc1}, |
|---|
| 648 | + {0x34, 0x40}, |
|---|
| 649 | + {0x35, 0x00}, |
|---|
| 650 | + {0x36, 0xc3}, |
|---|
| 651 | + {0x37, 0x0a}, |
|---|
| 652 | + {0x38, 0x00}, |
|---|
| 653 | + {0x39, 0x02}, |
|---|
| 654 | + {0x3a, 0x00}, |
|---|
| 655 | + {0x3b, 0xb2}, |
|---|
| 656 | + {0xa5, 0x10}, |
|---|
| 657 | + {0xa7, 0x1e}, |
|---|
| 658 | + {0xb0, 0xac}, |
|---|
| 659 | + {0xb1, 0x78}, |
|---|
| 660 | + {0xb2, 0x17}, |
|---|
| 661 | + {0xb3, 0xc1}, |
|---|
| 662 | + {0xb4, 0x40}, |
|---|
| 663 | + {0xb5, 0x00}, |
|---|
| 664 | + {0xb6, 0xc3}, |
|---|
| 665 | + {0xb7, 0x0a}, |
|---|
| 666 | + {0xb8, 0x00}, |
|---|
| 667 | + {0xb9, 0x02}, |
|---|
| 668 | + {0xba, 0x00}, |
|---|
| 669 | + {0xbb, 0xb2}, |
|---|
| 517 | 670 | |
|---|
| 518 | | - { 0xff, 0x0a }, |
|---|
| 519 | | - { 0x25, 0x10 }, |
|---|
| 520 | | - { 0x27, 0x1e }, |
|---|
| 521 | | - { 0x30, 0xac }, |
|---|
| 522 | | - { 0x31, 0x78 }, |
|---|
| 523 | | - { 0x32, 0x17 }, |
|---|
| 524 | | - { 0x33, 0xc1 }, |
|---|
| 525 | | - { 0x34, 0x40 }, |
|---|
| 526 | | - { 0x35, 0x00 }, |
|---|
| 527 | | - { 0x36, 0xc3 }, |
|---|
| 528 | | - { 0x37, 0x0a }, |
|---|
| 529 | | - { 0x38, 0x00 }, |
|---|
| 530 | | - { 0x39, 0x02 }, |
|---|
| 531 | | - { 0x3a, 0x00 }, |
|---|
| 532 | | - { 0x3b, 0xb2 }, |
|---|
| 533 | | - { 0xa5, 0x10 }, |
|---|
| 534 | | - { 0xa7, 0x1e }, |
|---|
| 535 | | - { 0xb0, 0xac }, |
|---|
| 536 | | - { 0xb1, 0x78 }, |
|---|
| 537 | | - { 0xb2, 0x17 }, |
|---|
| 538 | | - { 0xb3, 0xc1 }, |
|---|
| 539 | | - { 0xb4, 0x40 }, |
|---|
| 540 | | - { 0xb5, 0x00 }, |
|---|
| 541 | | - { 0xb6, 0xc3 }, |
|---|
| 542 | | - { 0xb7, 0x0a }, |
|---|
| 543 | | - { 0xb8, 0x00 }, |
|---|
| 544 | | - { 0xb9, 0x02 }, |
|---|
| 545 | | - { 0xba, 0x00 }, |
|---|
| 546 | | - { 0xbb, 0xb2 }, |
|---|
| 547 | | - { 0xff, 0x0b }, |
|---|
| 548 | | - { 0x25, 0x10 }, |
|---|
| 549 | | - { 0x27, 0x1e }, |
|---|
| 550 | | - { 0x30, 0xac }, |
|---|
| 551 | | - { 0x31, 0x78 }, |
|---|
| 552 | | - { 0x32, 0x17 }, |
|---|
| 553 | | - { 0x33, 0xc1 }, |
|---|
| 554 | | - { 0x34, 0x40 }, |
|---|
| 555 | | - { 0x35, 0x00 }, |
|---|
| 556 | | - { 0x36, 0xc3 }, |
|---|
| 557 | | - { 0x37, 0x0a }, |
|---|
| 558 | | - { 0x38, 0x00 }, |
|---|
| 559 | | - { 0x39, 0x02 }, |
|---|
| 560 | | - { 0x3a, 0x00 }, |
|---|
| 561 | | - { 0x3b, 0xb2 }, |
|---|
| 562 | | - { 0xa5, 0x10 }, |
|---|
| 563 | | - { 0xa7, 0x1e }, |
|---|
| 564 | | - { 0xb0, 0xac }, |
|---|
| 565 | | - { 0xb1, 0x78 }, |
|---|
| 566 | | - { 0xb2, 0x17 }, |
|---|
| 567 | | - { 0xb3, 0xc1 }, |
|---|
| 568 | | - { 0xb4, 0x40 }, |
|---|
| 569 | | - { 0xb5, 0x00 }, |
|---|
| 570 | | - { 0xb6, 0xc3 }, |
|---|
| 571 | | - { 0xb7, 0x0a }, |
|---|
| 572 | | - { 0xb8, 0x00 }, |
|---|
| 573 | | - { 0xb9, 0x02 }, |
|---|
| 574 | | - { 0xba, 0x00 }, |
|---|
| 575 | | - { 0xbb, 0xb2 }, |
|---|
| 671 | + {0xff, 0x00}, |
|---|
| 672 | + {0x00, 0x10}, |
|---|
| 673 | + {0x01, 0x10}, |
|---|
| 674 | + {0x02, 0x10}, |
|---|
| 675 | + {0x03, 0x10}, |
|---|
| 676 | + {0x22, 0x0b}, |
|---|
| 677 | + {0x23, 0x41}, |
|---|
| 678 | + {0x26, 0x0b}, |
|---|
| 679 | + {0x27, 0x41}, |
|---|
| 680 | + {0x2a, 0x0b}, |
|---|
| 681 | + {0x2b, 0x41}, |
|---|
| 682 | + {0x2e, 0x0b}, |
|---|
| 683 | + {0x2f, 0x41}, |
|---|
| 576 | 684 | |
|---|
| 577 | | - { 0xff, 0x13 }, |
|---|
| 578 | | - { 0x05, 0xa0 }, |
|---|
| 579 | | - { 0x31, 0xff }, |
|---|
| 580 | | - { 0x07, 0x47 }, |
|---|
| 581 | | - { 0x12, 0x04 }, |
|---|
| 582 | | - { 0x1e, 0x1f }, |
|---|
| 583 | | - { 0x1f, 0x27 }, |
|---|
| 584 | | - { 0x2e, 0x10 }, |
|---|
| 585 | | - { 0x2f, 0xc8 }, |
|---|
| 586 | | - { 0x31, 0xff }, |
|---|
| 587 | | - { 0x32, 0x00 }, |
|---|
| 588 | | - { 0x33, 0x00 }, |
|---|
| 589 | | - { 0x72, 0x05 }, |
|---|
| 590 | | - { 0x7a, 0xf0 }, |
|---|
| 591 | | - { 0xff, _MAR_BANK_ }, |
|---|
| 592 | | - { 0x10, 0xff }, |
|---|
| 593 | | - { 0x11, 0xff }, |
|---|
| 685 | + {0xff, 0x13}, |
|---|
| 686 | + {0x05, 0xa0}, |
|---|
| 687 | + {0x07, 0x47}, |
|---|
| 688 | + {0x12, 0x04}, |
|---|
| 689 | + {0x1e, 0x1f}, |
|---|
| 690 | + {0x1f, 0x27}, |
|---|
| 691 | + {0x2e, 0x10}, |
|---|
| 692 | + {0x2f, 0xc8}, |
|---|
| 693 | + {0x30, 0x00}, |
|---|
| 694 | + {0x31, 0xff}, |
|---|
| 695 | + {0x32, 0x00}, |
|---|
| 696 | + {0x33, 0x00}, |
|---|
| 697 | + {0x3a, 0xff}, |
|---|
| 698 | + {0x3b, 0xff}, |
|---|
| 699 | + {0x3c, 0xff}, |
|---|
| 700 | + {0x3d, 0xff}, |
|---|
| 701 | + {0x3e, 0xff}, |
|---|
| 702 | + {0x3f, 0x0f}, |
|---|
| 703 | + {0x70, 0x00}, |
|---|
| 704 | + {0x72, 0x05}, |
|---|
| 705 | + {0x7A, 0xf0}, |
|---|
| 706 | + {0x74, 0x00}, |
|---|
| 707 | + {0x76, 0x00}, |
|---|
| 708 | + {0x78, 0x00}, |
|---|
| 709 | + {0x75, 0xff}, |
|---|
| 710 | + {0x77, 0xff}, |
|---|
| 711 | + {0x79, 0xff}, |
|---|
| 712 | + {0x01, 0x0c}, |
|---|
| 713 | + {0x73, 0x23}, |
|---|
| 714 | + {0xff, _MAR_BANK_}, |
|---|
| 715 | + {0x40, 0x01}, |
|---|
| 716 | + {0x10, 0xff}, |
|---|
| 717 | + {0x11, 0xff}, |
|---|
| 718 | + {0x46, 0x49}, |
|---|
| 719 | + {0x45, 0x60}, |
|---|
| 720 | + {0x30, 0x0f}, |
|---|
| 721 | + {0x32, 0xff}, |
|---|
| 722 | + {0x34, 0xcd}, |
|---|
| 723 | + {0x36, 0x04}, |
|---|
| 724 | + {0x38, 0xff}, |
|---|
| 725 | + {0x07, 0x00}, |
|---|
| 726 | + {0x2a, 0x0a}, |
|---|
| 727 | + {0x3d, 0x11}, |
|---|
| 728 | + {0x3e, 0x11}, |
|---|
| 729 | + {0x3c, 0x01}, |
|---|
| 730 | + {0x1a, 0x92}, |
|---|
| 731 | + {0x1b, 0x00}, |
|---|
| 732 | + {0x1c, 0x00}, |
|---|
| 733 | + {0x05, 0x00}, |
|---|
| 734 | + {0x06, 0x00}, |
|---|
| 735 | + {0x0d, 0x01}, |
|---|
| 736 | + {0x00, 0x00},//mipi not enabled first |
|---|
| 737 | + {0x40, 0x00}, |
|---|
| 594 | 738 | |
|---|
| 595 | | - { 0x30, 0x0f }, |
|---|
| 596 | | - { 0x32, 0xff }, |
|---|
| 597 | | - { 0x34, 0xcd }, |
|---|
| 598 | | - { 0x36, 0x04 }, |
|---|
| 599 | | - { 0x38, 0xff }, |
|---|
| 600 | | - { 0x3c, 0x01 }, |
|---|
| 601 | | - { 0x3d, 0x11 }, |
|---|
| 602 | | - { 0x3e, 0x11 }, |
|---|
| 603 | | - { 0x45, 0x60 }, |
|---|
| 604 | | - { 0x46, 0x49 }, |
|---|
| 739 | + {0xff, 0x01}, |
|---|
| 740 | + //{ 0x82, 0x12 }, |
|---|
| 741 | + {0x80, 0x61}, |
|---|
| 742 | + {0x80, 0x60}, |
|---|
| 743 | + {0xa0, 0x20}, |
|---|
| 744 | + {0xa1, 0x20}, |
|---|
| 745 | + {0xa2, 0x20}, |
|---|
| 746 | + {0xa3, 0x20}, |
|---|
| 747 | + {0xed, 0x00}, |
|---|
| 605 | 748 | |
|---|
| 606 | | - { 0xff, _MTX_BANK_ }, |
|---|
| 607 | | - { 0xe9, 0x03 }, |
|---|
| 608 | | - { 0x03, 0x02 }, |
|---|
| 609 | | - { 0x04, 0x6c }, |
|---|
| 610 | | - { 0x01, 0xe4 }, |
|---|
| 611 | | - { 0x00, 0x7d }, |
|---|
| 612 | | - { 0x01, 0xe0 }, |
|---|
| 613 | | - { 0x02, 0xa0 }, |
|---|
| 614 | | - { 0x20, 0x1e }, |
|---|
| 615 | | - { 0x20, 0x1f }, |
|---|
| 616 | | - { 0x45, 0xcd }, |
|---|
| 617 | | - { 0x46, 0x42 }, |
|---|
| 618 | | - { 0x47, 0x36 }, |
|---|
| 619 | | - { 0x48, 0x0f }, |
|---|
| 620 | | - { 0x65, 0xcd }, |
|---|
| 621 | | - { 0x66, 0x42 }, |
|---|
| 622 | | - { 0x67, 0x0e }, |
|---|
| 623 | | - { 0x68, 0x0f }, |
|---|
| 624 | | - { 0x85, 0xcd }, |
|---|
| 625 | | - { 0x86, 0x42 }, |
|---|
| 626 | | - { 0x87, 0x0e }, |
|---|
| 627 | | - { 0x88, 0x0f }, |
|---|
| 628 | | - { 0xa5, 0xcd }, |
|---|
| 629 | | - { 0xa6, 0x42 }, |
|---|
| 630 | | - { 0xa7, 0x0e }, |
|---|
| 631 | | - { 0xa8, 0x0f }, |
|---|
| 632 | | - { 0xc5, 0xcd }, |
|---|
| 633 | | - { 0xc6, 0x42 }, |
|---|
| 634 | | - { 0xc7, 0x0e }, |
|---|
| 635 | | - { 0xc8, 0x0f }, |
|---|
| 636 | | - { 0xeb, 0x8d }, |
|---|
| 749 | + {0xff, 0x00}, |
|---|
| 750 | + {0x80, 0x0f}, |
|---|
| 751 | + {0x81, 0x02}, |
|---|
| 752 | + {0x82, 0x02}, |
|---|
| 753 | + {0x83, 0x02}, |
|---|
| 754 | + {0x84, 0x02}, |
|---|
| 755 | + {0x64, 0x01}, |
|---|
| 756 | + {0x65, 0x01}, |
|---|
| 757 | + {0x66, 0x01}, |
|---|
| 758 | + {0x67, 0x01}, |
|---|
| 759 | + {0x5c, 0x80}, |
|---|
| 760 | + {0x5d, 0x80}, |
|---|
| 761 | + {0x5e, 0x80}, |
|---|
| 762 | + {0x5f, 0x80}, |
|---|
| 763 | + {0xff, 0x01}, |
|---|
| 764 | + {0x84, 0x02}, |
|---|
| 765 | + {0x85, 0x02}, |
|---|
| 766 | + {0x86, 0x02}, |
|---|
| 767 | + {0x87, 0x02}, |
|---|
| 768 | + {0x8c, 0x40}, |
|---|
| 769 | + {0x8d, 0x40}, |
|---|
| 770 | + {0x8e, 0x40}, |
|---|
| 771 | + {0x8f, 0x40}, |
|---|
| 772 | + {0xff, 0x20}, |
|---|
| 773 | + {0x01, 0x00}, |
|---|
| 774 | + {0x12, 0xc0}, |
|---|
| 775 | + {0x13, 0x03}, |
|---|
| 776 | + {0x14, 0xc0}, |
|---|
| 777 | + {0x15, 0x03}, |
|---|
| 778 | + {0x16, 0xc0}, |
|---|
| 779 | + {0x17, 0x03}, |
|---|
| 780 | + {0x18, 0xc0}, |
|---|
| 781 | + {0x19, 0x03}, |
|---|
| 782 | + {0xff, 0x01}, |
|---|
| 783 | + {0x97, 0xf0}, |
|---|
| 784 | + {0x97, 0x0f}, |
|---|
| 637 | 785 | |
|---|
| 638 | | - { 0xff, _MAR_BANK_ }, |
|---|
| 639 | | - { 0x00, 0x00 }, //close mipi |
|---|
| 640 | | - { 0x40, 0x01 }, |
|---|
| 641 | | - { 0x40, 0x00 }, |
|---|
| 642 | | - { 0xff, 0x01 }, |
|---|
| 643 | | - { 0x97, 0x00 }, |
|---|
| 644 | | - { 0x97, 0x0f }, |
|---|
| 645 | | - |
|---|
| 646 | | - { 0xff, 0x00 }, //test pattern |
|---|
| 647 | | - { 0x78, 0x88 }, |
|---|
| 648 | | - { 0x79, 0x88 }, |
|---|
| 649 | | - { 0xff, 0x05 }, |
|---|
| 650 | | - { 0x2c, 0x08 }, |
|---|
| 651 | | - { 0x6a, 0x00 }, |
|---|
| 652 | | - { 0xff, 0x06 }, |
|---|
| 653 | | - { 0x2c, 0x08 }, |
|---|
| 654 | | - { 0x6a, 0x00 }, |
|---|
| 655 | | - { 0xff, 0x07 }, |
|---|
| 656 | | - { 0x2c, 0x08 }, |
|---|
| 657 | | - { 0x6a, 0x00 }, |
|---|
| 658 | | - { 0xff, 0x08 }, |
|---|
| 659 | | - { 0x2c, 0x08 }, |
|---|
| 660 | | - { 0x6a, 0x00 }, |
|---|
| 661 | | -}; |
|---|
| 662 | | - |
|---|
| 663 | | -static __maybe_unused const struct regval auto_detect_regs[] = { |
|---|
| 664 | | - { 0xFF, 0x13 }, |
|---|
| 665 | | - { 0x30, 0x7f }, |
|---|
| 666 | | - { 0x70, 0xf0 }, |
|---|
| 667 | | - |
|---|
| 668 | | - { 0xFF, 0x00 }, |
|---|
| 669 | | - { 0x00, 0x18 }, |
|---|
| 670 | | - { 0x01, 0x18 }, |
|---|
| 671 | | - { 0x02, 0x18 }, |
|---|
| 672 | | - { 0x03, 0x18 }, |
|---|
| 673 | | - |
|---|
| 674 | | - { 0x00, 0x10 }, |
|---|
| 675 | | - { 0x01, 0x10 }, |
|---|
| 676 | | - { 0x02, 0x10 }, |
|---|
| 677 | | - { 0x03, 0x10 }, |
|---|
| 786 | + {0xff, 0x00}, //test pattern |
|---|
| 787 | + {0x78, 0x88}, |
|---|
| 788 | + {0x79, 0x88}, |
|---|
| 789 | + {0xff, 0x05}, |
|---|
| 790 | + {0x2c, 0x08}, |
|---|
| 791 | + {0x6a, 0x00}, |
|---|
| 792 | + {0xff, 0x06}, |
|---|
| 793 | + {0x2c, 0x08}, |
|---|
| 794 | + {0x6a, 0x00}, |
|---|
| 795 | + {0xff, 0x07}, |
|---|
| 796 | + {0x2c, 0x08}, |
|---|
| 797 | + {0x6a, 0x00}, |
|---|
| 798 | + {0xff, 0x08}, |
|---|
| 799 | + {0x2c, 0x08}, |
|---|
| 800 | + {0x6a, 0x00}, |
|---|
| 678 | 801 | }; |
|---|
| 679 | 802 | |
|---|
| 680 | 803 | static struct nvp6188_mode supported_modes[] = { |
|---|
| .. | .. |
|---|
| 808 | 931 | return ret; |
|---|
| 809 | 932 | } |
|---|
| 810 | 933 | |
|---|
| 934 | +static int nv6188_read_htotal(struct nvp6188 *nvp6188, unsigned char ch) |
|---|
| 935 | +{ |
|---|
| 936 | + int ch_htotal = 0; |
|---|
| 937 | + unsigned char val_5xf2 = 0, val_5xf3 = 0; |
|---|
| 938 | + struct i2c_client *client = nvp6188->client; |
|---|
| 939 | + |
|---|
| 940 | + nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 941 | + nvp6188_read_reg(client, 0xf2, &val_5xf2); |
|---|
| 942 | + nvp6188_read_reg(client, 0xf3, &val_5xf3); |
|---|
| 943 | + ch_htotal = ((val_5xf3 << 8) | val_5xf2); |
|---|
| 944 | + |
|---|
| 945 | + return ch_htotal; |
|---|
| 946 | +} |
|---|
| 947 | + |
|---|
| 811 | 948 | static unsigned char nv6188_read_vfc(struct nvp6188 *nvp6188, unsigned char ch) |
|---|
| 812 | 949 | { |
|---|
| 813 | 950 | unsigned char ch_vfc = 0xff; |
|---|
| 814 | 951 | struct i2c_client *client = nvp6188->client; |
|---|
| 952 | + |
|---|
| 815 | 953 | nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 816 | 954 | nvp6188_read_reg(client, 0xf0, &ch_vfc); |
|---|
| 955 | + |
|---|
| 817 | 956 | return ch_vfc; |
|---|
| 818 | | -} |
|---|
| 819 | | - |
|---|
| 820 | | -static __maybe_unused int nvp6188_read_all_vfc(struct nvp6188 *nvp6188, |
|---|
| 821 | | - u8 *ch_vfc) |
|---|
| 822 | | -{ |
|---|
| 823 | | - int ret = 0; |
|---|
| 824 | | - int check_cnt = 0, ch = 0; |
|---|
| 825 | | - struct i2c_client *client = nvp6188->client; |
|---|
| 826 | | - |
|---|
| 827 | | - ret = nvp6188_write_array(client, |
|---|
| 828 | | - auto_detect_regs, ARRAY_SIZE(auto_detect_regs)); |
|---|
| 829 | | - if (ret) { |
|---|
| 830 | | - dev_err(&client->dev, "write auto_detect_regs faild %d", ret); |
|---|
| 831 | | - } |
|---|
| 832 | | - |
|---|
| 833 | | - while ((check_cnt++) < 50) { |
|---|
| 834 | | - for (ch = 0; ch < 4; ch++) { |
|---|
| 835 | | - ch_vfc[ch] = nv6188_read_vfc(nvp6188, ch); |
|---|
| 836 | | - } |
|---|
| 837 | | - if (ch_vfc[0] != 0xff || ch_vfc[1] != 0xff || |
|---|
| 838 | | - ch_vfc[2] != 0xff || ch_vfc[3] != 0xff) { |
|---|
| 839 | | - ret = 0; |
|---|
| 840 | | - if (ch == 3) { |
|---|
| 841 | | - dev_dbg(&client->dev, "try check cnt %d",check_cnt); |
|---|
| 842 | | - break; |
|---|
| 843 | | - } |
|---|
| 844 | | - } else { |
|---|
| 845 | | - usleep_range(20 * 1000, 40 * 1000); |
|---|
| 846 | | - } |
|---|
| 847 | | - } |
|---|
| 848 | | - |
|---|
| 849 | | - if (ret) { |
|---|
| 850 | | - dev_err(&client->dev, "read vfc faild %d", ret); |
|---|
| 851 | | - } else { |
|---|
| 852 | | - dev_dbg(&client->dev, "read vfc 0x%2x 0x%2x 0x%2x 0x%2x", |
|---|
| 853 | | - ch_vfc[0], ch_vfc[1], ch_vfc[2], ch_vfc[3]); |
|---|
| 854 | | - } |
|---|
| 855 | | - return ret; |
|---|
| 856 | 957 | } |
|---|
| 857 | 958 | |
|---|
| 858 | 959 | static __maybe_unused int nvp6188_auto_detect_hotplug(struct nvp6188 *nvp6188) |
|---|
| .. | .. |
|---|
| 924 | 1025 | __v4l2_ctrl_s_ctrl(nvp6188->link_freq, mode->mipi_freq_idx); |
|---|
| 925 | 1026 | pixel_rate = (u32)link_freq_items[mode->mipi_freq_idx] / mode->bpp * 2 * NVP6188_LANES; |
|---|
| 926 | 1027 | __v4l2_ctrl_s_ctrl_int64(nvp6188->pixel_rate, pixel_rate); |
|---|
| 927 | | - dev_err(&nvp6188->client->dev, "mipi_freq_idx %d\n", mode->mipi_freq_idx); |
|---|
| 928 | | - dev_err(&nvp6188->client->dev, "pixel_rate %lld\n", pixel_rate); |
|---|
| 1028 | + dev_info(&nvp6188->client->dev, "mipi_freq_idx %d\n", mode->mipi_freq_idx); |
|---|
| 1029 | + dev_info(&nvp6188->client->dev, "pixel_rate %lld\n", pixel_rate); |
|---|
| 929 | 1030 | } |
|---|
| 930 | 1031 | |
|---|
| 931 | 1032 | mutex_unlock(&nvp6188->mutex); |
|---|
| .. | .. |
|---|
| 981 | 1082 | return 0; |
|---|
| 982 | 1083 | } |
|---|
| 983 | 1084 | |
|---|
| 1085 | +static int nvp6188_enum_frame_interval(struct v4l2_subdev *sd, |
|---|
| 1086 | + struct v4l2_subdev_pad_config *cfg, |
|---|
| 1087 | + struct v4l2_subdev_frame_interval_enum *fie) |
|---|
| 1088 | +{ |
|---|
| 1089 | + if (fie->index >= ARRAY_SIZE(supported_modes)) |
|---|
| 1090 | + return -EINVAL; |
|---|
| 1091 | + |
|---|
| 1092 | + fie->code = supported_modes[fie->index].bus_fmt; |
|---|
| 1093 | + fie->width = supported_modes[fie->index].width; |
|---|
| 1094 | + fie->height = supported_modes[fie->index].height; |
|---|
| 1095 | + fie->interval = supported_modes[fie->index].max_fps; |
|---|
| 1096 | + |
|---|
| 1097 | + return 0; |
|---|
| 1098 | +} |
|---|
| 1099 | + |
|---|
| 984 | 1100 | static int nvp6188_enum_frame_sizes(struct v4l2_subdev *sd, |
|---|
| 985 | 1101 | struct v4l2_subdev_pad_config *cfg, |
|---|
| 986 | 1102 | struct v4l2_subdev_frame_size_enum *fse) |
|---|
| .. | .. |
|---|
| 1003 | 1119 | return 0; |
|---|
| 1004 | 1120 | } |
|---|
| 1005 | 1121 | |
|---|
| 1006 | | -static int nvp6188_g_mbus_config(struct v4l2_subdev *sd, |
|---|
| 1122 | +static int nvp6188_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, |
|---|
| 1007 | 1123 | struct v4l2_mbus_config *cfg) |
|---|
| 1008 | 1124 | { |
|---|
| 1009 | | - cfg->type = V4L2_MBUS_CSI2; |
|---|
| 1125 | + cfg->type = V4L2_MBUS_CSI2_DPHY; |
|---|
| 1010 | 1126 | cfg->flags = V4L2_MBUS_CSI2_4_LANE | |
|---|
| 1011 | 1127 | V4L2_MBUS_CSI2_CHANNELS; |
|---|
| 1128 | + |
|---|
| 1129 | + return 0; |
|---|
| 1130 | +} |
|---|
| 1131 | + |
|---|
| 1132 | +static int nvp6188_g_frame_interval(struct v4l2_subdev *sd, |
|---|
| 1133 | + struct v4l2_subdev_frame_interval *fi) |
|---|
| 1134 | +{ |
|---|
| 1135 | + struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 1136 | + const struct nvp6188_mode *mode = &nvp6188->cur_mode; |
|---|
| 1137 | + |
|---|
| 1138 | + mutex_lock(&nvp6188->mutex); |
|---|
| 1139 | + fi->interval = mode->max_fps; |
|---|
| 1140 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 1012 | 1141 | |
|---|
| 1013 | 1142 | return 0; |
|---|
| 1014 | 1143 | } |
|---|
| .. | .. |
|---|
| 1028 | 1157 | { |
|---|
| 1029 | 1158 | int ch = 0; |
|---|
| 1030 | 1159 | static u32 last_channel_reso[PAD_MAX] = {NVP_RESO_UNKOWN}; |
|---|
| 1031 | | - |
|---|
| 1032 | 1160 | memset(inf, 0, sizeof(*inf)); |
|---|
| 1161 | + |
|---|
| 1033 | 1162 | for (ch = 0; ch < PAD_MAX; ch++) { |
|---|
| 1034 | 1163 | //Maintain last resolution modify by cairufan |
|---|
| 1035 | 1164 | if (nvp6188->cur_mode.channel_reso[ch] != NVP_RESO_UNKOWN) |
|---|
| .. | .. |
|---|
| 1071 | 1200 | inf->height[ch] = 1080; |
|---|
| 1072 | 1201 | inf->fps[ch] = 25; |
|---|
| 1073 | 1202 | break; |
|---|
| 1203 | + case NVP_RESO_1300P_NSTC: |
|---|
| 1204 | + inf->width[ch] = 1600; |
|---|
| 1205 | + inf->height[ch] = 1300; |
|---|
| 1206 | + inf->fps[ch] = 30; |
|---|
| 1207 | + break; |
|---|
| 1208 | + case NVP_RESO_1300P_PAL: |
|---|
| 1209 | + inf->width[ch] = 1600; |
|---|
| 1210 | + inf->height[ch] = 1300; |
|---|
| 1211 | + inf->fps[ch] = 25; |
|---|
| 1212 | + break; |
|---|
| 1074 | 1213 | case NVP_RESO_1080P_NSTC: |
|---|
| 1075 | 1214 | default: |
|---|
| 1076 | 1215 | inf->width[ch] = 1920; |
|---|
| .. | .. |
|---|
| 1107 | 1246 | struct i2c_client *client = nvp6188->client; |
|---|
| 1108 | 1247 | |
|---|
| 1109 | 1248 | dev_info(&client->dev, "%s: on: %d\n", __func__, on); |
|---|
| 1110 | | - |
|---|
| 1111 | | - mutex_lock(&nvp6188->mutex); |
|---|
| 1112 | | - |
|---|
| 1113 | | - if (on) { |
|---|
| 1114 | | - nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1115 | | - nvp6188_write_reg(client, 0xff, 0xff); |
|---|
| 1116 | | - } else { |
|---|
| 1117 | | - nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1118 | | - nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 1119 | | - } |
|---|
| 1120 | | - |
|---|
| 1121 | | - mutex_unlock(&nvp6188->mutex); |
|---|
| 1249 | + if (!on) |
|---|
| 1250 | + usleep_range(40 * 1000, 50 * 1000); |
|---|
| 1122 | 1251 | } |
|---|
| 1123 | 1252 | |
|---|
| 1124 | 1253 | static long nvp6188_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) |
|---|
| .. | .. |
|---|
| 1292 | 1421 | */ |
|---|
| 1293 | 1422 | static __maybe_unused void nv6188_set_chn_960p(struct nvp6188 *nvp6188, u8 ch, |
|---|
| 1294 | 1423 | u8 ntpal) |
|---|
| 1424 | + |
|---|
| 1295 | 1425 | { |
|---|
| 1296 | 1426 | unsigned char val_0x54 = 0, val_20x01 = 0; |
|---|
| 1297 | 1427 | struct i2c_client *client = nvp6188->client; |
|---|
| .. | .. |
|---|
| 1299 | 1429 | dev_info(&client->dev, "%s: ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1300 | 1430 | |
|---|
| 1301 | 1431 | nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 1302 | | - nvp6188_write_reg(client, 0x08+ch, 0x00); |
|---|
| 1303 | | - nvp6188_write_reg(client, 0x18+ch, 0x0f); |
|---|
| 1304 | | - nvp6188_write_reg(client, 0x30+ch, 0x12); |
|---|
| 1305 | | - nvp6188_write_reg(client, 0x34+ch, 0x00); |
|---|
| 1432 | + nvp6188_write_reg(client, 0x00 + ch, 0x10); |
|---|
| 1433 | + nvp6188_write_reg(client, 0x08 + ch, 0x00); |
|---|
| 1434 | + nvp6188_write_reg(client, 0x18 + ch, 0x0f); |
|---|
| 1435 | + nvp6188_write_reg(client, 0x30 + ch, 0x12); |
|---|
| 1436 | + nvp6188_write_reg(client, 0x34 + ch, 0x00); |
|---|
| 1306 | 1437 | nvp6188_read_reg(client, 0x54, &val_0x54); |
|---|
| 1307 | | - val_0x54 &= ~(0x10<<ch); |
|---|
| 1438 | + val_0x54 &= ~(0x10 << ch); |
|---|
| 1308 | 1439 | nvp6188_write_reg(client, 0x54, val_0x54); |
|---|
| 1309 | | - nvp6188_write_reg(client, 0x58+ch, ntpal?0x40:0x48); |
|---|
| 1310 | | - nvp6188_write_reg(client, 0x5c+ch, ntpal?0x80:0x80); |
|---|
| 1311 | | - nvp6188_write_reg(client, 0x64+ch, ntpal?0x28:0x28); |
|---|
| 1312 | | - nvp6188_write_reg(client, 0x81+ch, ntpal?0x07:0x06); |
|---|
| 1313 | | - nvp6188_write_reg(client, 0x85+ch, 0x0b); |
|---|
| 1314 | | - nvp6188_write_reg(client, 0x89+ch, 0x00); |
|---|
| 1315 | | - nvp6188_write_reg(client, ch+0x8e, 0x00); |
|---|
| 1316 | | - nvp6188_write_reg(client, 0xa0+ch, 0x05); |
|---|
| 1440 | + nvp6188_write_reg(client, 0x58 + ch, ntpal ? 0x40 : 0x48); |
|---|
| 1441 | + nvp6188_write_reg(client, 0x5c + ch, ntpal ? 0x80 : 0x80); |
|---|
| 1442 | + nvp6188_write_reg(client, 0x64 + ch, ntpal ? 0x28 : 0x28); |
|---|
| 1443 | + nvp6188_write_reg(client, 0x81 + ch, ntpal ? 0x07 : 0x06); |
|---|
| 1444 | + nvp6188_write_reg(client, 0x85 + ch, 0x0b); |
|---|
| 1445 | + nvp6188_write_reg(client, 0x89 + ch, 0x00); |
|---|
| 1446 | + nvp6188_write_reg(client, 0x8e + ch, 0x00); |
|---|
| 1447 | + nvp6188_write_reg(client, 0xa0 + ch, 0x05); |
|---|
| 1317 | 1448 | nvp6188_write_reg(client, 0xff, 0x01); |
|---|
| 1318 | | - nvp6188_write_reg(client, 0x84+ch, 0x02); |
|---|
| 1319 | | - nvp6188_write_reg(client, 0x88+ch, 0x00); |
|---|
| 1320 | | - nvp6188_write_reg(client, 0x8c+ch, 0x40); |
|---|
| 1321 | | - nvp6188_write_reg(client, 0xa0+ch, 0x20); |
|---|
| 1322 | | - nvp6188_write_reg(client, 0xff, 0x05+ch); |
|---|
| 1449 | + nvp6188_write_reg(client, 0x84 + ch, 0x02); |
|---|
| 1450 | + nvp6188_write_reg(client, 0x88 + ch, 0x00); |
|---|
| 1451 | + nvp6188_write_reg(client, 0x8c + ch, 0x40); |
|---|
| 1452 | + nvp6188_write_reg(client, 0xa0 + ch, 0x20); |
|---|
| 1453 | + nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 1454 | + nvp6188_write_reg(client, 0x00, 0xd0); |
|---|
| 1323 | 1455 | nvp6188_write_reg(client, 0x01, 0x22); |
|---|
| 1324 | 1456 | nvp6188_write_reg(client, 0x05, 0x04); |
|---|
| 1325 | 1457 | nvp6188_write_reg(client, 0x08, 0x55); |
|---|
| .. | .. |
|---|
| 1353 | 1485 | nvp6188_write_reg(client, 0xd1, 0x00); |
|---|
| 1354 | 1486 | nvp6188_write_reg(client, 0xd5, 0x80); |
|---|
| 1355 | 1487 | nvp6188_write_reg(client, 0xff, 0x09); |
|---|
| 1356 | | - nvp6188_write_reg(client, 0x96+ch*0x20, 0x00); |
|---|
| 1357 | | - nvp6188_write_reg(client, 0x98+ch*0x20, 0x00); |
|---|
| 1358 | | - nvp6188_write_reg(client, ch*0x20+0x9e, 0x00); |
|---|
| 1488 | + nvp6188_write_reg(client, 0x96 + (ch * 0x20), 0x00); |
|---|
| 1489 | + nvp6188_write_reg(client, 0x98 + (ch * 0x20), 0x00); |
|---|
| 1490 | + nvp6188_write_reg(client, 0x9e + (ch * 0x20), 0x00); |
|---|
| 1491 | + nvp6188_write_reg(client, 0xff, 0x11); |
|---|
| 1492 | + nvp6188_write_reg(client, 0x00 + (ch * 0x20), 0x00); |
|---|
| 1359 | 1493 | nvp6188_write_reg(client, 0xff, _MAR_BANK_); |
|---|
| 1360 | 1494 | nvp6188_read_reg(client, 0x01, &val_20x01); |
|---|
| 1361 | | - val_20x01 &= (~(0x03<<(ch*2))); |
|---|
| 1495 | + val_20x01 &= (~(0x03 << (ch * 2))); |
|---|
| 1362 | 1496 | //val_20x01 |=(0x01<<(ch*2)); |
|---|
| 1363 | 1497 | nvp6188_write_reg(client, 0x01, val_20x01); |
|---|
| 1364 | | - nvp6188_write_reg(client, 0x12+ch*2, 0x80); |
|---|
| 1365 | | - nvp6188_write_reg(client, 0x13+ch*2, 0x02); |
|---|
| 1498 | + nvp6188_write_reg(client, 0x12 + (ch * 2), 0x80); |
|---|
| 1499 | + nvp6188_write_reg(client, 0x13 + (ch * 2), 0x02); |
|---|
| 1366 | 1500 | } |
|---|
| 1367 | 1501 | |
|---|
| 1368 | 1502 | //each channel setting |
|---|
| .. | .. |
|---|
| 1377 | 1511 | unsigned char val_0x54 = 0, val_20x01 = 0; |
|---|
| 1378 | 1512 | struct i2c_client *client = nvp6188->client; |
|---|
| 1379 | 1513 | |
|---|
| 1380 | | - dev_info(&client->dev, "%s: ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1381 | | - |
|---|
| 1514 | + dev_err(&client->dev, "%s: ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1382 | 1515 | nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 1516 | + nvp6188_write_reg(client, 0x00 + ch, 0x10); |
|---|
| 1383 | 1517 | nvp6188_write_reg(client, 0x08 + ch, ntpal ? 0xdd : 0xa0); |
|---|
| 1384 | 1518 | nvp6188_write_reg(client, 0x18 + ch, 0x08); |
|---|
| 1385 | 1519 | nvp6188_write_reg(client, 0x22 + ch * 4, 0x0b); |
|---|
| .. | .. |
|---|
| 1398 | 1532 | nvp6188_write_reg(client, 0x81 + ch, ntpal ? 0xf0 : 0xe0); |
|---|
| 1399 | 1533 | nvp6188_write_reg(client, 0x85 + ch, 0x00); |
|---|
| 1400 | 1534 | nvp6188_write_reg(client, 0x89 + ch, 0x00); |
|---|
| 1401 | | - nvp6188_write_reg(client, ch + 0x8e, 0x00); |
|---|
| 1535 | + nvp6188_write_reg(client, 0x8e + ch, 0x00); |
|---|
| 1402 | 1536 | nvp6188_write_reg(client, 0xa0 + ch, 0x05); |
|---|
| 1403 | | - |
|---|
| 1404 | 1537 | nvp6188_write_reg(client, 0xff, 0x01); |
|---|
| 1405 | 1538 | nvp6188_write_reg(client, 0x84 + ch, 0x02); |
|---|
| 1406 | 1539 | nvp6188_write_reg(client, 0x88 + ch, 0x00); |
|---|
| 1407 | 1540 | nvp6188_write_reg(client, 0x8c + ch, 0x40); |
|---|
| 1408 | 1541 | nvp6188_write_reg(client, 0xa0 + ch, 0x20); |
|---|
| 1409 | 1542 | nvp6188_write_reg(client, 0xed, 0x00); |
|---|
| 1410 | | - |
|---|
| 1411 | 1543 | nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 1544 | + nvp6188_write_reg(client, 0x00, 0xd0); |
|---|
| 1412 | 1545 | nvp6188_write_reg(client, 0x01, 0x22); |
|---|
| 1413 | 1546 | nvp6188_write_reg(client, 0x05, 0x00); |
|---|
| 1414 | 1547 | nvp6188_write_reg(client, 0x08, 0x55); |
|---|
| .. | .. |
|---|
| 1437 | 1570 | nvp6188_write_reg(client, 0xb9, 0x72); |
|---|
| 1438 | 1571 | nvp6188_write_reg(client, 0xd1, 0x00); |
|---|
| 1439 | 1572 | nvp6188_write_reg(client, 0xd5, 0x80); |
|---|
| 1440 | | - |
|---|
| 1441 | 1573 | nvp6188_write_reg(client, 0xff, 0x09); |
|---|
| 1442 | | - nvp6188_write_reg(client, 0x96 + ch * 0x20, 0x10); |
|---|
| 1443 | | - nvp6188_write_reg(client, 0x98 + ch * 0x20, ntpal ? 0xc0 : 0xe0); |
|---|
| 1444 | | - nvp6188_write_reg(client, ch * 0x20 + 0x9e, 0x00); |
|---|
| 1445 | | - |
|---|
| 1574 | + nvp6188_write_reg(client, 0x96 + (ch * 0x20), 0x10); |
|---|
| 1575 | + nvp6188_write_reg(client, 0x98 + (ch * 0x20), ntpal ? 0xc0 : 0xe0); |
|---|
| 1576 | + nvp6188_write_reg(client, 0x9e + (ch * 0x20), 0x00); |
|---|
| 1577 | + nvp6188_write_reg(client, 0xff, 0x11); |
|---|
| 1578 | + nvp6188_write_reg(client, 0x00 + (ch * 0x20), 0x00); |
|---|
| 1446 | 1579 | nvp6188_write_reg(client, 0xff, _MAR_BANK_); |
|---|
| 1447 | 1580 | nvp6188_read_reg(client, 0x01, &val_20x01); |
|---|
| 1448 | 1581 | val_20x01 &= (~(0x03 << (ch * 2))); |
|---|
| 1449 | 1582 | val_20x01 |= (0x02 << (ch * 2)); |
|---|
| 1450 | 1583 | nvp6188_write_reg(client, 0x01, val_20x01); |
|---|
| 1451 | | - nvp6188_write_reg(client, 0x12 + ch * 2, 0xe0); |
|---|
| 1452 | | - nvp6188_write_reg(client, 0x13 + ch * 2, 0x01); |
|---|
| 1584 | + nvp6188_write_reg(client, 0x12 + (ch * 2), 0xe0); |
|---|
| 1585 | + nvp6188_write_reg(client, 0x13 + (ch * 2), 0x01); |
|---|
| 1453 | 1586 | } |
|---|
| 1454 | 1587 | |
|---|
| 1455 | 1588 | //each channel setting |
|---|
| .. | .. |
|---|
| 1465 | 1598 | struct i2c_client *client = nvp6188->client; |
|---|
| 1466 | 1599 | |
|---|
| 1467 | 1600 | dev_info(&client->dev, "%s: ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1468 | | - |
|---|
| 1469 | 1601 | nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 1602 | + nvp6188_write_reg(client, 0x00 + ch, 0x00); |
|---|
| 1470 | 1603 | nvp6188_write_reg(client, 0x08 + ch, 0x00); |
|---|
| 1471 | | - nvp6188_write_reg(client, 0x18 + ch, 0x3f); |
|---|
| 1604 | + nvp6188_write_reg(client, 0x18 + ch, 0x10); |
|---|
| 1472 | 1605 | nvp6188_write_reg(client, 0x30 + ch, 0x12); |
|---|
| 1473 | 1606 | nvp6188_write_reg(client, 0x34 + ch, 0x00); |
|---|
| 1474 | 1607 | nvp6188_read_reg(client, 0x54, &val_0x54); |
|---|
| .. | .. |
|---|
| 1480 | 1613 | nvp6188_write_reg(client, 0x81 + ch, ntpal ? 0x0d : 0x0c); |
|---|
| 1481 | 1614 | nvp6188_write_reg(client, 0x85 + ch, 0x00); |
|---|
| 1482 | 1615 | nvp6188_write_reg(client, 0x89 + ch, 0x00); |
|---|
| 1483 | | - nvp6188_write_reg(client, ch + 0x8e, 0x00); |
|---|
| 1616 | + nvp6188_write_reg(client, 0x8e + ch, 0x00); |
|---|
| 1484 | 1617 | nvp6188_write_reg(client, 0xa0 + ch, 0x05); |
|---|
| 1485 | | - |
|---|
| 1486 | 1618 | nvp6188_write_reg(client, 0xff, 0x01); |
|---|
| 1487 | 1619 | nvp6188_write_reg(client, 0x84 + ch, 0x02); |
|---|
| 1488 | 1620 | nvp6188_write_reg(client, 0x88 + ch, 0x00); |
|---|
| 1489 | 1621 | nvp6188_write_reg(client, 0x8c + ch, 0x40); |
|---|
| 1490 | 1622 | nvp6188_write_reg(client, 0xa0 + ch, 0x20); |
|---|
| 1491 | | - |
|---|
| 1492 | 1623 | nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 1624 | + nvp6188_write_reg(client, 0x00, 0xf0); |
|---|
| 1493 | 1625 | nvp6188_write_reg(client, 0x01, 0x22); |
|---|
| 1494 | 1626 | nvp6188_write_reg(client, 0x05, 0x04); |
|---|
| 1495 | 1627 | nvp6188_write_reg(client, 0x08, 0x55); |
|---|
| .. | .. |
|---|
| 1499 | 1631 | nvp6188_write_reg(client, 0x30, 0xe0); |
|---|
| 1500 | 1632 | nvp6188_write_reg(client, 0x31, 0x43); |
|---|
| 1501 | 1633 | nvp6188_write_reg(client, 0x32, 0xa2); |
|---|
| 1502 | | - nvp6188_write_reg(client, 0x47, 0xee); |
|---|
| 1503 | | - nvp6188_write_reg(client, 0x50, 0xc6); |
|---|
| 1634 | + nvp6188_write_reg(client, 0x47, 0x04); |
|---|
| 1635 | + nvp6188_write_reg(client, 0x50, 0x84); |
|---|
| 1504 | 1636 | nvp6188_write_reg(client, 0x57, 0x00); |
|---|
| 1505 | 1637 | nvp6188_write_reg(client, 0x58, 0x77); |
|---|
| 1506 | 1638 | nvp6188_write_reg(client, 0x5b, 0x41); |
|---|
| 1507 | | - nvp6188_write_reg(client, 0x5c, 0x7C); |
|---|
| 1639 | + nvp6188_write_reg(client, 0x5c, 0x78); |
|---|
| 1508 | 1640 | nvp6188_write_reg(client, 0x5f, 0x00); |
|---|
| 1509 | | - nvp6188_write_reg(client, 0x62, 0x20); |
|---|
| 1641 | + nvp6188_write_reg(client, 0x62, 0x00); |
|---|
| 1510 | 1642 | nvp6188_write_reg(client, 0x7b, 0x11); |
|---|
| 1511 | 1643 | nvp6188_write_reg(client, 0x7c, 0x01); |
|---|
| 1512 | 1644 | nvp6188_write_reg(client, 0x7d, 0x80); |
|---|
| 1513 | 1645 | nvp6188_write_reg(client, 0x80, 0x00); |
|---|
| 1514 | 1646 | nvp6188_write_reg(client, 0x90, 0x01); |
|---|
| 1515 | 1647 | nvp6188_write_reg(client, 0xa9, 0x00); |
|---|
| 1516 | | - nvp6188_write_reg(client, 0xb5, 0x40); |
|---|
| 1517 | | - nvp6188_write_reg(client, 0xb8, 0x39); |
|---|
| 1648 | + nvp6188_write_reg(client, 0xb5, 0x00); |
|---|
| 1649 | + nvp6188_write_reg(client, 0xb8, 0xb9); |
|---|
| 1518 | 1650 | nvp6188_write_reg(client, 0xb9, 0x72); |
|---|
| 1519 | 1651 | nvp6188_write_reg(client, 0xd1, 0x00); |
|---|
| 1520 | 1652 | nvp6188_write_reg(client, 0xd5, 0x80); |
|---|
| 1521 | | - |
|---|
| 1522 | 1653 | nvp6188_write_reg(client, 0xff, 0x09); |
|---|
| 1523 | | - nvp6188_write_reg(client, 0x96 + ch * 0x20, 0x00); |
|---|
| 1524 | | - nvp6188_write_reg(client, 0x98 + ch * 0x20, 0x00); |
|---|
| 1525 | | - nvp6188_write_reg(client, ch * 0x20 + 0x9e, 0x00); |
|---|
| 1526 | | - |
|---|
| 1654 | + nvp6188_write_reg(client, 0x96 + (ch * 0x20), 0x00); |
|---|
| 1655 | + nvp6188_write_reg(client, 0x98 + (ch * 0x20), 0x00); |
|---|
| 1656 | + nvp6188_write_reg(client, 0x9e + (ch * 0x20), 0x00); |
|---|
| 1657 | + nvp6188_write_reg(client, 0xff, 0x11); |
|---|
| 1658 | + nvp6188_write_reg(client, 0x00 + (ch * 0x20), 0x00); |
|---|
| 1527 | 1659 | nvp6188_write_reg(client, 0xff, _MAR_BANK_); |
|---|
| 1528 | 1660 | nvp6188_read_reg(client, 0x01, &val_20x01); |
|---|
| 1529 | 1661 | val_20x01 &= (~(0x03 << (ch * 2))); |
|---|
| 1530 | 1662 | val_20x01 |= (0x01 << (ch * 2)); |
|---|
| 1531 | 1663 | nvp6188_write_reg(client, 0x01, val_20x01); |
|---|
| 1532 | | - nvp6188_write_reg(client, 0x12 + ch * 2, 0x80); |
|---|
| 1533 | | - nvp6188_write_reg(client, 0x13 + ch * 2, 0x02); |
|---|
| 1664 | + nvp6188_write_reg(client, 0x12 + (ch * 2), 0x80); |
|---|
| 1665 | + nvp6188_write_reg(client, 0x13 + (ch * 2), 0x02); |
|---|
| 1534 | 1666 | } |
|---|
| 1535 | 1667 | |
|---|
| 1536 | 1668 | //each channel setting |
|---|
| .. | .. |
|---|
| 1545 | 1677 | unsigned char val_0x54 = 0, val_20x01 = 0; |
|---|
| 1546 | 1678 | struct i2c_client *client = nvp6188->client; |
|---|
| 1547 | 1679 | |
|---|
| 1548 | | - dev_info(&client->dev, "%s: ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1680 | + dev_info(&client->dev, "%s ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1549 | 1681 | nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 1682 | + nvp6188_write_reg(client, 0x00 + ch, 0x10); |
|---|
| 1550 | 1683 | nvp6188_write_reg(client, 0x08 + ch, 0x00); |
|---|
| 1551 | | - nvp6188_write_reg(client, 0x18 + ch, 0x3f); |
|---|
| 1684 | + nvp6188_write_reg(client, 0x18 + ch, 0x10); |
|---|
| 1552 | 1685 | nvp6188_write_reg(client, 0x30 + ch, 0x12); |
|---|
| 1553 | 1686 | nvp6188_write_reg(client, 0x34 + ch, 0x00); |
|---|
| 1554 | 1687 | nvp6188_read_reg(client, 0x54, &val_0x54); |
|---|
| .. | .. |
|---|
| 1560 | 1693 | nvp6188_write_reg(client, 0x81 + ch, ntpal ? 0x03 : 0x02); |
|---|
| 1561 | 1694 | nvp6188_write_reg(client, 0x85 + ch, 0x00); |
|---|
| 1562 | 1695 | nvp6188_write_reg(client, 0x89 + ch, 0x10); |
|---|
| 1563 | | - nvp6188_write_reg(client, ch + 0x8e, 0x00); |
|---|
| 1696 | + nvp6188_write_reg(client, 0x8e + ch, 0x00); |
|---|
| 1564 | 1697 | nvp6188_write_reg(client, 0xa0 + ch, 0x05); |
|---|
| 1565 | | - |
|---|
| 1566 | 1698 | nvp6188_write_reg(client, 0xff, 0x01); |
|---|
| 1567 | 1699 | nvp6188_write_reg(client, 0x84 + ch, 0x02); |
|---|
| 1568 | 1700 | nvp6188_write_reg(client, 0x88 + ch, 0x00); |
|---|
| 1569 | 1701 | nvp6188_write_reg(client, 0x8c + ch, 0x40); |
|---|
| 1570 | 1702 | nvp6188_write_reg(client, 0xa0 + ch, 0x20); |
|---|
| 1571 | | - |
|---|
| 1572 | 1703 | nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 1704 | + nvp6188_write_reg(client, 0x00, 0xd0); |
|---|
| 1573 | 1705 | nvp6188_write_reg(client, 0x01, 0x22); |
|---|
| 1574 | 1706 | nvp6188_write_reg(client, 0x05, 0x04); |
|---|
| 1575 | 1707 | nvp6188_write_reg(client, 0x08, 0x55); |
|---|
| .. | .. |
|---|
| 1598 | 1730 | nvp6188_write_reg(client, 0xb9, 0x72); |
|---|
| 1599 | 1731 | nvp6188_write_reg(client, 0xd1, 0x00); |
|---|
| 1600 | 1732 | nvp6188_write_reg(client, 0xd5, 0x80); |
|---|
| 1601 | | - |
|---|
| 1602 | 1733 | nvp6188_write_reg(client, 0xff, 0x09); |
|---|
| 1603 | | - nvp6188_write_reg(client, 0x96 + ch * 0x20, 0x00); |
|---|
| 1604 | | - nvp6188_write_reg(client, 0x98 + ch * 0x20, 0x00); |
|---|
| 1605 | | - nvp6188_write_reg(client, ch * 0x20 + 0x9e, 0x00); |
|---|
| 1606 | | - |
|---|
| 1734 | + nvp6188_write_reg(client, 0x96 + (ch * 0x20), 0x00); |
|---|
| 1735 | + nvp6188_write_reg(client, 0x98 + (ch * 0x20), 0x00); |
|---|
| 1736 | + nvp6188_write_reg(client, 0x9e + (ch * 0x20), 0x00); |
|---|
| 1737 | + nvp6188_write_reg(client, 0xff, 0x11); |
|---|
| 1738 | + nvp6188_write_reg(client, 0x00 + (ch * 0x20), 0x00); |
|---|
| 1607 | 1739 | nvp6188_write_reg(client, 0xff, _MAR_BANK_); |
|---|
| 1608 | 1740 | nvp6188_read_reg(client, 0x01, &val_20x01); |
|---|
| 1609 | 1741 | val_20x01 &= (~(0x03 << (ch * 2))); |
|---|
| 1610 | 1742 | nvp6188_write_reg(client, 0x01, val_20x01); |
|---|
| 1611 | | - nvp6188_write_reg(client, 0x12 + ch * 2, 0xc0); |
|---|
| 1612 | | - nvp6188_write_reg(client, 0x13 + ch * 2, 0x03); |
|---|
| 1743 | + nvp6188_write_reg(client, 0x12 + (ch * 2), 0xc0); |
|---|
| 1744 | + nvp6188_write_reg(client, 0x13 + (ch * 2), 0x03); |
|---|
| 1745 | +} |
|---|
| 1746 | + |
|---|
| 1747 | +//each channel setting |
|---|
| 1748 | +/* |
|---|
| 1749 | + * 1600x1300p |
|---|
| 1750 | + * dev:0x60 / 0x62 / 0x64 / 0x66 |
|---|
| 1751 | + * ch : 0 ~ 3 |
|---|
| 1752 | + * ntpal: 1:25p, 0:30p |
|---|
| 1753 | + * detection: 5xf3<<8 | 5xf2 = 0x0708(30p) =0x0870(25p) |
|---|
| 1754 | + */ |
|---|
| 1755 | +static void nv6188_set_chn_1300p(struct nvp6188 *nvp6188, unsigned char ch, unsigned char ntpal) |
|---|
| 1756 | +{ |
|---|
| 1757 | + unsigned char val_0x54 = 0, val_20x01 = 0; |
|---|
| 1758 | + struct i2c_client *client = nvp6188->client; |
|---|
| 1759 | + |
|---|
| 1760 | + dev_info(&client->dev, "%s ch %d ntpal %d", __func__, ch, ntpal); |
|---|
| 1761 | + |
|---|
| 1762 | + nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 1763 | + nvp6188_write_reg(client, 0x00 + ch, 0x10); |
|---|
| 1764 | + nvp6188_write_reg(client, 0x08 + ch, 0x00); |
|---|
| 1765 | + nvp6188_write_reg(client, 0x18 + ch, 0x10); |
|---|
| 1766 | + nvp6188_write_reg(client, 0x30 + ch, 0x12); |
|---|
| 1767 | + nvp6188_write_reg(client, 0x34 + ch, 0x00); |
|---|
| 1768 | + nvp6188_read_reg(client, 0x54, &val_0x54); |
|---|
| 1769 | + val_0x54 &= ~(0x10 << ch); |
|---|
| 1770 | + nvp6188_write_reg(client, 0x54, val_0x54); |
|---|
| 1771 | + nvp6188_write_reg(client, 0x58 + ch, ntpal ? 0x80 : 0x80); |
|---|
| 1772 | + nvp6188_write_reg(client, 0x5c + ch, ntpal ? 0x80 : 0x80); |
|---|
| 1773 | + nvp6188_write_reg(client, 0x64 + ch, ntpal ? 0x00 : 0x01); |
|---|
| 1774 | + nvp6188_write_reg(client, 0x81 + ch, ntpal ? 0x03 : 0x02); |
|---|
| 1775 | + nvp6188_write_reg(client, 0x85 + ch, 0x00); |
|---|
| 1776 | + nvp6188_write_reg(client, 0x89 + ch, 0x10); |
|---|
| 1777 | + nvp6188_write_reg(client, 0x8e + ch, 0x00); |
|---|
| 1778 | + nvp6188_write_reg(client, 0xa0 + ch, 0x05); |
|---|
| 1779 | + nvp6188_write_reg(client, 0xff, 0x01); |
|---|
| 1780 | + nvp6188_write_reg(client, 0x84 + ch, 0x02); |
|---|
| 1781 | + nvp6188_write_reg(client, 0x88 + ch, 0x00); |
|---|
| 1782 | + nvp6188_write_reg(client, 0x8c + ch, 0x40); |
|---|
| 1783 | + nvp6188_write_reg(client, 0xa0 + ch, 0x20); |
|---|
| 1784 | + nvp6188_write_reg(client, 0xff, 0x05 + ch); |
|---|
| 1785 | + nvp6188_write_reg(client, 0x00, 0xd0); |
|---|
| 1786 | + nvp6188_write_reg(client, 0x01, 0x22); |
|---|
| 1787 | + nvp6188_write_reg(client, 0x05, 0x04); |
|---|
| 1788 | + nvp6188_write_reg(client, 0x08, 0x55); |
|---|
| 1789 | + nvp6188_write_reg(client, 0x25, 0xdc); |
|---|
| 1790 | + nvp6188_write_reg(client, 0x28, 0x80); |
|---|
| 1791 | + nvp6188_write_reg(client, 0x2f, 0x00); |
|---|
| 1792 | + nvp6188_write_reg(client, 0x30, 0xe0); |
|---|
| 1793 | + nvp6188_write_reg(client, 0x31, 0x41); |
|---|
| 1794 | + nvp6188_write_reg(client, 0x32, 0xa2); |
|---|
| 1795 | + nvp6188_write_reg(client, 0x47, 0xee); |
|---|
| 1796 | + nvp6188_write_reg(client, 0x50, 0xc6); |
|---|
| 1797 | + nvp6188_write_reg(client, 0x57, 0x00); |
|---|
| 1798 | + nvp6188_write_reg(client, 0x58, 0x77); |
|---|
| 1799 | + nvp6188_write_reg(client, 0x5b, 0x41); |
|---|
| 1800 | + nvp6188_write_reg(client, 0x5c, 0x78); |
|---|
| 1801 | + nvp6188_write_reg(client, 0x5f, 0x00); |
|---|
| 1802 | + nvp6188_write_reg(client, 0x62, 0x00); |
|---|
| 1803 | + nvp6188_write_reg(client, 0x6C, 0x00); |
|---|
| 1804 | + nvp6188_write_reg(client, 0x6d, 0x00); |
|---|
| 1805 | + nvp6188_write_reg(client, 0x6e, 0x00); |
|---|
| 1806 | + nvp6188_write_reg(client, 0x6f, 0x00); |
|---|
| 1807 | + nvp6188_write_reg(client, 0x7b, 0x11); |
|---|
| 1808 | + nvp6188_write_reg(client, 0x7c, 0x01); |
|---|
| 1809 | + nvp6188_write_reg(client, 0x7d, 0x80); |
|---|
| 1810 | + nvp6188_write_reg(client, 0x80, 0x00); |
|---|
| 1811 | + nvp6188_write_reg(client, 0x90, 0x01); |
|---|
| 1812 | + nvp6188_write_reg(client, 0xa9, 0x00); |
|---|
| 1813 | + nvp6188_write_reg(client, 0xb5, 0x00); |
|---|
| 1814 | + nvp6188_write_reg(client, 0xb8, 0xb9); |
|---|
| 1815 | + nvp6188_write_reg(client, 0xb9, 0x72); |
|---|
| 1816 | + nvp6188_write_reg(client, 0xd1, 0x00); |
|---|
| 1817 | + nvp6188_write_reg(client, 0xd5, 0x80); |
|---|
| 1818 | + nvp6188_write_reg(client, 0xff, 0x09); |
|---|
| 1819 | + nvp6188_write_reg(client, 0x96 + (ch * 0x20), 0x00); |
|---|
| 1820 | + nvp6188_write_reg(client, 0x98 + (ch * 0x20), 0x00); |
|---|
| 1821 | + nvp6188_write_reg(client, 0x9e + (ch * 0x20), 0x00); |
|---|
| 1822 | + nvp6188_write_reg(client, 0xff, 0x11); //additional settings for 1300p |
|---|
| 1823 | + nvp6188_write_reg(client, 0x01 + (ch * 0x20), ntpal ? 0x01 : 0x00); |
|---|
| 1824 | + nvp6188_write_reg(client, 0x02 + (ch * 0x20), ntpal ? 0xb2 : 0x50); |
|---|
| 1825 | + nvp6188_write_reg(client, 0x03 + (ch * 0x20), 0x06); |
|---|
| 1826 | + nvp6188_write_reg(client, 0x04 + (ch * 0x20), 0x40); |
|---|
| 1827 | + nvp6188_write_reg(client, 0x05 + (ch * 0x20), ntpal ? 0x08 : 0x07); |
|---|
| 1828 | + nvp6188_write_reg(client, 0x06 + (ch * 0x20), ntpal ? 0x70 : 0x08); |
|---|
| 1829 | + nvp6188_write_reg(client, 0x07 + (ch * 0x20), 0x00); |
|---|
| 1830 | + nvp6188_write_reg(client, 0x08 + (ch * 0x20), 0x00); |
|---|
| 1831 | + nvp6188_write_reg(client, 0x0a + (ch * 0x20), 0x05); |
|---|
| 1832 | + nvp6188_write_reg(client, 0x0b + (ch * 0x20), 0x14); |
|---|
| 1833 | + nvp6188_write_reg(client, 0x0c + (ch * 0x20), 0x05); |
|---|
| 1834 | + nvp6188_write_reg(client, 0x0d + (ch * 0x20), 0x5f); |
|---|
| 1835 | + nvp6188_write_reg(client, 0x00 + (ch * 0x20), 0x03); |
|---|
| 1836 | + nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1837 | + nvp6188_read_reg(client, 0x01, &val_20x01); |
|---|
| 1838 | + val_20x01 &= (~(0x03 << (ch * 2))); |
|---|
| 1839 | + nvp6188_write_reg(client, 0x01, val_20x01); |
|---|
| 1840 | + nvp6188_write_reg(client, 0x12 + (ch * 2), 0x20); |
|---|
| 1841 | + nvp6188_write_reg(client, 0x13 + (ch * 2), 0x03); |
|---|
| 1613 | 1842 | } |
|---|
| 1614 | 1843 | |
|---|
| 1615 | 1844 | static __maybe_unused void nvp6188_manual_mode(struct nvp6188 *nvp6188, u8 ch, u32 fmt) |
|---|
| .. | .. |
|---|
| 1617 | 1846 | unsigned char val_13x70 = 0, val_13x71 = 0; |
|---|
| 1618 | 1847 | struct i2c_client *client = nvp6188->client; |
|---|
| 1619 | 1848 | |
|---|
| 1620 | | - nvp6188_write_reg(client, 0xFF, 0x13); |
|---|
| 1621 | | - nvp6188_read_reg(client, 0x70, &val_13x70); |
|---|
| 1622 | | - val_13x70 |= (0x01 << ch); |
|---|
| 1623 | | - nvp6188_write_reg(client, 0x70, val_13x70); |
|---|
| 1624 | | - nvp6188_read_reg(client, 0x71, &val_13x71); |
|---|
| 1625 | | - val_13x71 |= (0x01 << ch); |
|---|
| 1626 | | - nvp6188_write_reg(client, 0x71, val_13x71); |
|---|
| 1627 | | - |
|---|
| 1849 | + if (fmt != NVP_RESO_UNKOWN) { |
|---|
| 1850 | + nvp6188_write_reg(client, 0xFF, 0x13); |
|---|
| 1851 | + nvp6188_read_reg(client, 0x70, &val_13x70); |
|---|
| 1852 | + val_13x70 |= (0x01 << ch); |
|---|
| 1853 | + nvp6188_write_reg(client, 0x70, val_13x70); |
|---|
| 1854 | + nvp6188_read_reg(client, 0x71, &val_13x71); |
|---|
| 1855 | + val_13x71 |= (0x01 << ch); |
|---|
| 1856 | + nvp6188_write_reg(client, 0x71, val_13x71); |
|---|
| 1857 | + } |
|---|
| 1628 | 1858 | switch (fmt) { |
|---|
| 1629 | 1859 | case NVP_RESO_960H_PAL: |
|---|
| 1630 | 1860 | nv6188_set_chn_960h(nvp6188, ch, 1); |
|---|
| .. | .. |
|---|
| 1638 | 1868 | case NVP_RESO_1080P_PAL: |
|---|
| 1639 | 1869 | nv6188_set_chn_1080p(nvp6188, ch, 1); |
|---|
| 1640 | 1870 | break; |
|---|
| 1871 | + case NVP_RESO_1300P_PAL: |
|---|
| 1872 | + nv6188_set_chn_1300p(nvp6188, ch, 1); |
|---|
| 1873 | + break; |
|---|
| 1641 | 1874 | case NVP_RESO_960H_NSTC: |
|---|
| 1642 | 1875 | nv6188_set_chn_960h(nvp6188, ch, 0); |
|---|
| 1643 | 1876 | break; |
|---|
| .. | .. |
|---|
| 1650 | 1883 | case NVP_RESO_1080P_NSTC: |
|---|
| 1651 | 1884 | nv6188_set_chn_1080p(nvp6188, ch, 0); |
|---|
| 1652 | 1885 | break; |
|---|
| 1886 | + case NVP_RESO_1300P_NSTC: |
|---|
| 1887 | + nv6188_set_chn_1300p(nvp6188, ch, 0); |
|---|
| 1888 | + break; |
|---|
| 1653 | 1889 | default: |
|---|
| 1654 | | - nv6188_set_chn_1080p(nvp6188, ch, 1); |
|---|
| 1890 | + nv6188_set_chn_1080p(nvp6188, ch, 0); |
|---|
| 1655 | 1891 | |
|---|
| 1656 | 1892 | dev_err(&client->dev, "channel %d not detect\n", ch); |
|---|
| 1657 | 1893 | nvp6188_write_reg(client, 0xFF, 0x13); |
|---|
| .. | .. |
|---|
| 1659 | 1895 | val_13x70 &= ~(0x01 << ch); |
|---|
| 1660 | 1896 | nvp6188_write_reg(client, 0x70, val_13x70); |
|---|
| 1661 | 1897 | nvp6188_write_reg(client, 0xFF, 0x05 + ch); |
|---|
| 1898 | + nvp6188_write_reg(client, 0x58, 0x77); |
|---|
| 1662 | 1899 | nvp6188_write_reg(client, 0xb8, 0xb8); |
|---|
| 1663 | 1900 | break; |
|---|
| 1664 | 1901 | } |
|---|
| 1902 | + |
|---|
| 1903 | + // clear unknown count status |
|---|
| 1904 | + nvp6188->cur_mode.unkown_reso_count[ch] = 0; |
|---|
| 1665 | 1905 | } |
|---|
| 1666 | 1906 | |
|---|
| 1667 | 1907 | static __maybe_unused void nvp6188_auto_detect_fmt(struct nvp6188 *nvp6188) |
|---|
| 1668 | 1908 | { |
|---|
| 1669 | 1909 | u8 ch = 0; |
|---|
| 1670 | 1910 | u32 reso = 0; |
|---|
| 1671 | | - unsigned char ch_vfc = 0xff; |
|---|
| 1911 | + unsigned char ch_vfc = 0xff, val_13x70 = 0xf0; |
|---|
| 1912 | + int ch_htotal = 0; |
|---|
| 1672 | 1913 | struct i2c_client *client = nvp6188->client; |
|---|
| 1673 | 1914 | |
|---|
| 1674 | 1915 | for (ch = 0; ch < PAD_MAX; ch++) { |
|---|
| 1675 | 1916 | ch_vfc = nv6188_read_vfc(nvp6188, ch); |
|---|
| 1676 | | - |
|---|
| 1917 | + if (ch_vfc == 0xFF) { |
|---|
| 1918 | + ch_htotal = nv6188_read_htotal(nvp6188, ch); |
|---|
| 1919 | + if (ch_htotal == 0x0708) |
|---|
| 1920 | + ch_vfc = NVP_RESO_1300P_NSTC_VALUE; |
|---|
| 1921 | + else if (ch_htotal == 0x0870) |
|---|
| 1922 | + ch_vfc = NVP_RESO_1300P_PAL_VALUE; |
|---|
| 1923 | + } |
|---|
| 1677 | 1924 | switch (ch_vfc) { |
|---|
| 1678 | 1925 | case NVP_RESO_960H_NSTC_VALUE: |
|---|
| 1679 | | - dev_dbg(&client->dev, "channel %d det 960h nstc", ch); |
|---|
| 1680 | | - reso = NVP_RESO_960H_NSTC; |
|---|
| 1926 | + dev_dbg(&client->dev, "channel %d det 960h nstc", ch); |
|---|
| 1927 | + reso = NVP_RESO_960H_NSTC; |
|---|
| 1681 | 1928 | break; |
|---|
| 1682 | 1929 | case NVP_RESO_960H_PAL_VALUE: |
|---|
| 1683 | | - dev_dbg(&client->dev, "channel %d det 960h pal", ch); |
|---|
| 1684 | | - reso = NVP_RESO_960H_PAL; |
|---|
| 1930 | + dev_dbg(&client->dev, "channel %d det 960h pal", ch); |
|---|
| 1931 | + reso = NVP_RESO_960H_PAL; |
|---|
| 1685 | 1932 | break; |
|---|
| 1686 | 1933 | case NVP_RESO_720P_NSTC_VALUE: |
|---|
| 1687 | | - dev_dbg(&client->dev, "channel %d det 720p nstc", ch); |
|---|
| 1688 | | - reso = NVP_RESO_720P_NSTC; |
|---|
| 1934 | + dev_dbg(&client->dev, "channel %d det 720p nstc", ch); |
|---|
| 1935 | + reso = NVP_RESO_720P_NSTC; |
|---|
| 1689 | 1936 | break; |
|---|
| 1690 | 1937 | case NVP_RESO_720P_PAL_VALUE: |
|---|
| 1691 | | - dev_dbg(&client->dev, "channel %d det 720p pal", ch); |
|---|
| 1692 | | - reso = NVP_RESO_720P_PAL; |
|---|
| 1938 | + dev_dbg(&client->dev, "channel %d det 720p pal", ch); |
|---|
| 1939 | + reso = NVP_RESO_720P_PAL; |
|---|
| 1693 | 1940 | break; |
|---|
| 1694 | 1941 | case NVP_RESO_1080P_NSTC_VALUE: |
|---|
| 1695 | | - dev_dbg(&client->dev, "channel %d det 1080p nstc", ch); |
|---|
| 1696 | | - reso = NVP_RESO_1080P_NSTC; |
|---|
| 1942 | + dev_dbg(&client->dev, "channel %d det 1080p nstc", ch); |
|---|
| 1943 | + reso = NVP_RESO_1080P_NSTC; |
|---|
| 1697 | 1944 | break; |
|---|
| 1698 | 1945 | case NVP_RESO_1080P_PAL_VALUE: |
|---|
| 1699 | | - dev_dbg(&client->dev, "channel %d det 1080p pal", ch); |
|---|
| 1700 | | - reso = NVP_RESO_1080P_PAL; |
|---|
| 1946 | + dev_dbg(&client->dev, "channel %d det 1080p pal", ch); |
|---|
| 1947 | + reso = NVP_RESO_1080P_PAL; |
|---|
| 1701 | 1948 | break; |
|---|
| 1702 | 1949 | case NVP_RESO_960P_NSTC_VALUE: |
|---|
| 1703 | | - dev_dbg(&client->dev, "channel %d det 960p nstc", ch); |
|---|
| 1704 | | - reso = NVP_RESO_960P_NSTC; |
|---|
| 1950 | + dev_dbg(&client->dev, "channel %d det 960p nstc", ch); |
|---|
| 1951 | + reso = NVP_RESO_960P_NSTC; |
|---|
| 1705 | 1952 | break; |
|---|
| 1706 | 1953 | case NVP_RESO_960P_PAL_VALUE: |
|---|
| 1707 | | - dev_dbg(&client->dev, "channel %d det 960p pal", ch); |
|---|
| 1708 | | - reso = NVP_RESO_960P_PAL; |
|---|
| 1954 | + dev_dbg(&client->dev, "channel %d det 960p pal", ch); |
|---|
| 1955 | + reso = NVP_RESO_960P_PAL; |
|---|
| 1956 | + break; |
|---|
| 1957 | + case NVP_RESO_1300P_NSTC_VALUE: |
|---|
| 1958 | + dev_dbg(&client->dev, "channel %d det 1300p nstc", ch); |
|---|
| 1959 | + reso = NVP_RESO_1300P_NSTC; |
|---|
| 1960 | + break; |
|---|
| 1961 | + case NVP_RESO_1300P_PAL_VALUE: |
|---|
| 1962 | + dev_dbg(&client->dev, "channel %d det 1300p pal", ch); |
|---|
| 1963 | + reso = NVP_RESO_1300P_PAL; |
|---|
| 1709 | 1964 | break; |
|---|
| 1710 | 1965 | default: |
|---|
| 1711 | | - dev_dbg(&client->dev, "channel %d not detect\n", ch); |
|---|
| 1712 | | - reso = NVP_RESO_UNKOWN; |
|---|
| 1966 | + dev_dbg(&client->dev, "channel %d not detect\n", ch); |
|---|
| 1967 | + reso = NVP_RESO_UNKOWN; |
|---|
| 1713 | 1968 | break; |
|---|
| 1714 | 1969 | } |
|---|
| 1715 | 1970 | |
|---|
| 1716 | 1971 | if (reso != nvp6188->cur_mode.channel_reso[ch]) { |
|---|
| 1717 | | - if ((nvp6188->cur_mode.channel_reso[ch] != NVP_RESO_UNKOWN) && |
|---|
| 1718 | | - (reso == NVP_RESO_UNKOWN) && |
|---|
| 1719 | | - ((nvp6188->detect_status & (0x01 << ch)) == 0)) { |
|---|
| 1972 | + if (nvp6188->cur_mode.channel_reso[ch] != NVP_RESO_UNKOWN && |
|---|
| 1973 | + reso == NVP_RESO_UNKOWN && |
|---|
| 1974 | + (nvp6188->detect_status & (0x01 << ch)) == 0) { |
|---|
| 1720 | 1975 | dev_info(&client->dev, "channel(%d) fmt(%d) -> invalid(0x%x)", |
|---|
| 1721 | | - ch, nvp6188->cur_mode.channel_reso[ch], ch_vfc); |
|---|
| 1722 | | - return; |
|---|
| 1976 | + ch, nvp6188->cur_mode.channel_reso[ch], ch_vfc); |
|---|
| 1977 | + if (nvp6188->cur_mode.unkown_reso_count[ch] < 5) { |
|---|
| 1978 | + nvp6188_write_reg(client, 0xFF, 0x13); |
|---|
| 1979 | + nvp6188_read_reg(client, 0x70, &val_13x70); |
|---|
| 1980 | + val_13x70 &= ~(0x01 << ch); |
|---|
| 1981 | + nvp6188_write_reg(client, 0x70, val_13x70); |
|---|
| 1982 | + nvp6188->cur_mode.unkown_reso_count[ch]++; |
|---|
| 1983 | + continue; |
|---|
| 1984 | + } |
|---|
| 1723 | 1985 | } |
|---|
| 1724 | | - |
|---|
| 1725 | 1986 | dev_info(&client->dev, "channel(%d) fmt(%d) -> cur(%d)", |
|---|
| 1726 | | - ch, nvp6188->cur_mode.channel_reso[ch], reso); |
|---|
| 1987 | + ch, nvp6188->cur_mode.channel_reso[ch], reso); |
|---|
| 1727 | 1988 | nvp6188_manual_mode(nvp6188, ch, reso); |
|---|
| 1728 | 1989 | nvp6188->cur_mode.channel_reso[ch] = reso; |
|---|
| 1729 | 1990 | } |
|---|
| .. | .. |
|---|
| 1745 | 2006 | struct nvp6188 *nvp6188 = (struct nvp6188 *) data; |
|---|
| 1746 | 2007 | struct i2c_client *client = nvp6188->client; |
|---|
| 1747 | 2008 | int need_reset_wait = -1; |
|---|
| 1748 | | - |
|---|
| 2009 | + nvp6188->disable_dump_register = true; |
|---|
| 1749 | 2010 | if (nvp6188->power_on) { |
|---|
| 1750 | 2011 | nvp6188_auto_detect_hotplug(nvp6188); |
|---|
| 1751 | 2012 | nvp6188->last_detect_status = nvp6188->detect_status; |
|---|
| 1752 | 2013 | nvp6188->is_reset = 0; |
|---|
| 1753 | 2014 | } |
|---|
| 1754 | 2015 | while (!kthread_should_stop()) { |
|---|
| 1755 | | - if (nvp6188->power_on) { |
|---|
| 2016 | + if (nvp6188->disable_dump_register && nvp6188->power_on) { |
|---|
| 1756 | 2017 | mutex_lock(&nvp6188->mutex); |
|---|
| 1757 | 2018 | nvp6188_auto_detect_hotplug(nvp6188); |
|---|
| 1758 | 2019 | nvp6188_auto_detect_fmt(nvp6188); |
|---|
| 2020 | + |
|---|
| 1759 | 2021 | mutex_unlock(&nvp6188->mutex); |
|---|
| 1760 | 2022 | if (nvp6188->last_detect_status != nvp6188->detect_status) { |
|---|
| 1761 | 2023 | dev_info(&client->dev, "last_detect_status(0x%x) -> detect_status(0x%x)", |
|---|
| 1762 | | - nvp6188->last_detect_status, nvp6188->detect_status); |
|---|
| 2024 | + nvp6188->last_detect_status, nvp6188->detect_status); |
|---|
| 1763 | 2025 | nvp6188->last_detect_status = nvp6188->detect_status; |
|---|
| 1764 | 2026 | input_event(nvp6188->input_dev, EV_MSC, MSC_RAW, nvp6188->detect_status); |
|---|
| 1765 | 2027 | input_sync(nvp6188->input_dev); |
|---|
| .. | .. |
|---|
| 1770 | 2032 | } else if (need_reset_wait == 0) { |
|---|
| 1771 | 2033 | need_reset_wait = -1; |
|---|
| 1772 | 2034 | nvp6188->is_reset = 1; |
|---|
| 1773 | | - dev_err(&client->dev, "trigger reset time up\n"); |
|---|
| 2035 | + dev_info(&client->dev, "trigger reset time up\n"); |
|---|
| 1774 | 2036 | } |
|---|
| 1775 | 2037 | } |
|---|
| 1776 | 2038 | set_current_state(TASK_INTERRUPTIBLE); |
|---|
| .. | .. |
|---|
| 1785 | 2047 | struct i2c_client *client = nvp6188->client; |
|---|
| 1786 | 2048 | nvp6188->detect_thread = kthread_create(detect_thread_function, |
|---|
| 1787 | 2049 | nvp6188, "nvp6188_kthread"); |
|---|
| 2050 | + |
|---|
| 1788 | 2051 | if (IS_ERR(nvp6188->detect_thread)) { |
|---|
| 1789 | 2052 | dev_err(&client->dev, "kthread_create nvp6188_kthread failed\n"); |
|---|
| 1790 | 2053 | ret = PTR_ERR(nvp6188->detect_thread); |
|---|
| .. | .. |
|---|
| 1800 | 2063 | if (nvp6188->detect_thread) |
|---|
| 1801 | 2064 | kthread_stop(nvp6188->detect_thread); |
|---|
| 1802 | 2065 | nvp6188->detect_thread = NULL; |
|---|
| 2066 | + |
|---|
| 1803 | 2067 | return 0; |
|---|
| 1804 | 2068 | } |
|---|
| 1805 | 2069 | |
|---|
| 1806 | | -static int nvp6188_reg_check(struct nvp6188 *nvp6188) |
|---|
| 2070 | +static int __maybe_unused nvp6188_reg_check(struct nvp6188 *nvp6188) |
|---|
| 1807 | 2071 | { |
|---|
| 1808 | 2072 | unsigned char val_20x52 = 0, val_20x53 = 0; |
|---|
| 1809 | | - unsigned char val_20x52_bak = 0, val_20x53_bak = 0; |
|---|
| 1810 | | - int check_value1, check_value2, check_cnt = 10; |
|---|
| 2073 | + int check_value1 = 0, check_value2 = 0, check_cnt = 10; |
|---|
| 1811 | 2074 | struct i2c_client *client = nvp6188->client; |
|---|
| 1812 | 2075 | |
|---|
| 1813 | | - dev_dbg(&client->dev, "[%s::%d]\n", __func__, __LINE__); |
|---|
| 1814 | 2076 | nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1815 | 2077 | nvp6188_write_reg(client, 0x00, 0xff); // open mipi |
|---|
| 2078 | + usleep_range(100 * 1000, 100 * 1000); |
|---|
| 2079 | + //nvp6188_write_reg(client, 0x40, 0x01); |
|---|
| 2080 | + //nvp6188_write_reg(client, 0x40, 0x00); |
|---|
| 1816 | 2081 | while (check_cnt--) { |
|---|
| 1817 | 2082 | nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1818 | 2083 | nvp6188_read_reg(client, 0x52, &val_20x52); |
|---|
| .. | .. |
|---|
| 1820 | 2085 | check_value1 = (val_20x52 << 8) | val_20x53; |
|---|
| 1821 | 2086 | usleep_range(80 * 1000, 100 * 1000); |
|---|
| 1822 | 2087 | nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1823 | | - nvp6188_read_reg(client, 0x52, &val_20x52_bak); |
|---|
| 1824 | | - nvp6188_read_reg(client, 0x53, &val_20x53_bak); |
|---|
| 1825 | | - check_value2 = (val_20x52_bak << 8) | val_20x53_bak; |
|---|
| 1826 | | - if (check_value1 == check_value2) { |
|---|
| 1827 | | - dev_info(&client->dev, "attention!!! check cnt = %d\n", check_cnt); |
|---|
| 2088 | + nvp6188_read_reg(client, 0x52, &val_20x52); |
|---|
| 2089 | + nvp6188_read_reg(client, 0x53, &val_20x53); |
|---|
| 2090 | + check_value2 = (val_20x52 << 8) | val_20x53; |
|---|
| 2091 | + if (check_value2 <= 2 || check_value1 == check_value2) { |
|---|
| 2092 | + dev_err(&client->dev, "attention!!! check cnt = %d\n", check_cnt); |
|---|
| 1828 | 2093 | nvp6188_write_reg(client, 0xff, 0x01); |
|---|
| 1829 | 2094 | nvp6188_write_reg(client, 0x97, 0xf0); |
|---|
| 1830 | 2095 | usleep_range(40 * 1000, 50 * 1000); |
|---|
| 1831 | 2096 | nvp6188_write_reg(client, 0x97, 0x0f); |
|---|
| 1832 | 2097 | } else { |
|---|
| 1833 | 2098 | dev_err(&client->dev, "check_value1=%x, check_value2=%x,check cnt = %d\n", |
|---|
| 1834 | | - check_value1, check_value2, check_cnt); |
|---|
| 2099 | + check_value1, check_value2, check_cnt); |
|---|
| 1835 | 2100 | break; |
|---|
| 1836 | 2101 | } |
|---|
| 1837 | 2102 | } |
|---|
| 1838 | | - |
|---|
| 1839 | 2103 | return check_cnt; |
|---|
| 1840 | 2104 | } |
|---|
| 1841 | | -static int __nvp6188_start_stream(struct nvp6188 *nvp6188) |
|---|
| 2105 | + |
|---|
| 2106 | +static int nvp6188_auto_det_set(struct nvp6188 *nvp6188) |
|---|
| 2107 | +{ |
|---|
| 2108 | + struct i2c_client *client = nvp6188->client; |
|---|
| 2109 | + |
|---|
| 2110 | + dev_info(&client->dev, "[%s::%d]\n", __func__, __LINE__); |
|---|
| 2111 | + |
|---|
| 2112 | + nvp6188_write_reg(client, 0xff, 0x13); |
|---|
| 2113 | + nvp6188_write_reg(client, 0x30, 0x7f); |
|---|
| 2114 | + nvp6188_write_reg(client, 0x70, 0xf0); |
|---|
| 2115 | + nvp6188_write_reg(client, 0xff, 0x00); |
|---|
| 2116 | + nvp6188_write_reg(client, 0x00, 0x18); |
|---|
| 2117 | + nvp6188_write_reg(client, 0x01, 0x18); |
|---|
| 2118 | + nvp6188_write_reg(client, 0x02, 0x18); |
|---|
| 2119 | + nvp6188_write_reg(client, 0x03, 0x18); |
|---|
| 2120 | + usleep_range(30 * 1000, 40 * 1000); |
|---|
| 2121 | + nvp6188_write_reg(client, 0x00, 0x10); |
|---|
| 2122 | + nvp6188_write_reg(client, 0x01, 0x10); |
|---|
| 2123 | + nvp6188_write_reg(client, 0x02, 0x10); |
|---|
| 2124 | + nvp6188_write_reg(client, 0x03, 0x10); |
|---|
| 2125 | + |
|---|
| 2126 | + return 0; |
|---|
| 2127 | +} |
|---|
| 2128 | + |
|---|
| 2129 | +static int nvp6188_video_init(struct nvp6188 *nvp6188) |
|---|
| 1842 | 2130 | { |
|---|
| 1843 | 2131 | int ret; |
|---|
| 1844 | 2132 | int array_size = 0; |
|---|
| .. | .. |
|---|
| 1855 | 2143 | ret = nvp6188_write_array(nvp6188->client, |
|---|
| 1856 | 2144 | nvp6188->cur_mode.global_reg_list, array_size); |
|---|
| 1857 | 2145 | if (ret) { |
|---|
| 1858 | | - dev_err(&client->dev, "%s: global_reg_list failed", __func__); |
|---|
| 1859 | | - return ret; |
|---|
| 1860 | | - } |
|---|
| 1861 | | - |
|---|
| 1862 | | - ret = nvp6188_write_array(nvp6188->client, |
|---|
| 1863 | | - auto_detect_regs, ARRAY_SIZE(auto_detect_regs)); |
|---|
| 1864 | | - if (ret) { |
|---|
| 1865 | | - dev_err(&client->dev, "%s: auto_detect_regs failed", __func__); |
|---|
| 2146 | + dev_err(&client->dev, "__nvp6188_start_stream global_reg_list faild"); |
|---|
| 1866 | 2147 | return ret; |
|---|
| 1867 | 2148 | } |
|---|
| 1868 | 2149 | |
|---|
| 1869 | 2150 | nvp6188_init_default_fmt(nvp6188, NVP_RESO_UNKOWN); |
|---|
| 1870 | | - usleep_range(500*1000, 1000*1000); |
|---|
| 2151 | + nvp6188_auto_det_set(nvp6188); |
|---|
| 2152 | + usleep_range(150*1000, 150*1000); |
|---|
| 1871 | 2153 | nvp6188_auto_detect_fmt(nvp6188); |
|---|
| 2154 | + |
|---|
| 2155 | + return 0; |
|---|
| 2156 | +} |
|---|
| 2157 | + |
|---|
| 2158 | +static int __nvp6188_start_stream(struct nvp6188 *nvp6188) |
|---|
| 2159 | +{ |
|---|
| 2160 | + struct i2c_client *client = nvp6188->client; |
|---|
| 2161 | + |
|---|
| 2162 | + if (nvp6188->detect_thread) { |
|---|
| 2163 | + nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 2164 | + nvp6188_write_reg(client, 0x00, 0xff); |
|---|
| 2165 | + return 0; |
|---|
| 2166 | + } |
|---|
| 2167 | + |
|---|
| 1872 | 2168 | nvp6188_audio_init(nvp6188); |
|---|
| 1873 | 2169 | nvp6188_reg_check(nvp6188); |
|---|
| 1874 | 2170 | detect_thread_start(nvp6188); |
|---|
| .. | .. |
|---|
| 1878 | 2174 | static int __nvp6188_stop_stream(struct nvp6188 *nvp6188) |
|---|
| 1879 | 2175 | { |
|---|
| 1880 | 2176 | struct i2c_client *client = nvp6188->client; |
|---|
| 2177 | + |
|---|
| 1881 | 2178 | nvp6188_write_reg(client, 0xff, 0x20); |
|---|
| 1882 | 2179 | nvp6188_write_reg(client, 0x00, 0x00); |
|---|
| 1883 | 2180 | nvp6188_write_reg(client, 0x40, 0x01); |
|---|
| 1884 | 2181 | nvp6188_write_reg(client, 0x40, 0x00); |
|---|
| 1885 | | - detect_thread_stop(nvp6188); |
|---|
| 2182 | + //detect_thread_stop(nvp6188); |
|---|
| 2183 | + usleep_range(100 * 1000, 150 * 1000); |
|---|
| 2184 | + |
|---|
| 1886 | 2185 | return 0; |
|---|
| 1887 | 2186 | } |
|---|
| 1888 | 2187 | |
|---|
| .. | .. |
|---|
| 1891 | 2190 | struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 1892 | 2191 | struct i2c_client *client = nvp6188->client; |
|---|
| 1893 | 2192 | |
|---|
| 1894 | | - dev_err(&client->dev, "s_stream: %d. %dx%d\n", on, |
|---|
| 2193 | + dev_info(&client->dev, "s_stream: %d. %dx%d\n", on, |
|---|
| 1895 | 2194 | nvp6188->cur_mode.width, |
|---|
| 1896 | 2195 | nvp6188->cur_mode.height); |
|---|
| 1897 | 2196 | |
|---|
| .. | .. |
|---|
| 1925 | 2224 | /* If the power state is not modified - no work to do. */ |
|---|
| 1926 | 2225 | if (nvp6188->power_on == !!on) |
|---|
| 1927 | 2226 | goto exit; |
|---|
| 1928 | | - |
|---|
| 1929 | | - dev_err(&client->dev, "%s: on %d\n", __func__, on); |
|---|
| 1930 | 2227 | |
|---|
| 1931 | 2228 | if (on) { |
|---|
| 1932 | 2229 | ret = pm_runtime_get_sync(&client->dev); |
|---|
| .. | .. |
|---|
| 1985 | 2282 | gpiod_set_value_cansleep(nvp6188->reset_gpio, 0); |
|---|
| 1986 | 2283 | usleep_range(10 * 1000, 20 * 1000); |
|---|
| 1987 | 2284 | gpiod_set_value_cansleep(nvp6188->reset_gpio, 1); |
|---|
| 1988 | | - usleep_range(10 * 1000, 20 * 1000); |
|---|
| 2285 | + usleep_range(100 * 1000, 110 * 1000); |
|---|
| 1989 | 2286 | |
|---|
| 1990 | 2287 | //Resolve audio register reset caused by reset_gpio |
|---|
| 1991 | 2288 | nvp6188_audio_init(nvp6188); |
|---|
| .. | .. |
|---|
| 2059 | 2356 | goto err_free_handler; |
|---|
| 2060 | 2357 | } |
|---|
| 2061 | 2358 | |
|---|
| 2062 | | - dev_info(&nvp6188->client->dev, "mipi_freq_idx %d\n", mode->mipi_freq_idx); |
|---|
| 2063 | | - dev_info(&nvp6188->client->dev, "pixel_rate %lld\n", pixel_rate); |
|---|
| 2064 | | - dev_info(&nvp6188->client->dev, "link_freq %lld\n", link_freq_items[mode->mipi_freq_idx]); |
|---|
| 2359 | + dev_dbg(&nvp6188->client->dev, "mipi_freq_idx %d\n", mode->mipi_freq_idx); |
|---|
| 2360 | + dev_dbg(&nvp6188->client->dev, "pixel_rate %lld\n", pixel_rate); |
|---|
| 2361 | + dev_dbg(&nvp6188->client->dev, "link_freq %lld\n", link_freq_items[mode->mipi_freq_idx]); |
|---|
| 2065 | 2362 | |
|---|
| 2066 | 2363 | nvp6188->subdev.ctrl_handler = handler; |
|---|
| 2067 | 2364 | |
|---|
| .. | .. |
|---|
| 2073 | 2370 | return ret; |
|---|
| 2074 | 2371 | } |
|---|
| 2075 | 2372 | |
|---|
| 2076 | | -static int nvp6188_runtime_resume(struct device *dev) |
|---|
| 2373 | +static int __maybe_unused nvp6188_runtime_resume(struct device *dev) |
|---|
| 2077 | 2374 | { |
|---|
| 2078 | 2375 | struct i2c_client *client = to_i2c_client(dev); |
|---|
| 2079 | 2376 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
|---|
| .. | .. |
|---|
| 2082 | 2379 | return __nvp6188_power_on(nvp6188); |
|---|
| 2083 | 2380 | } |
|---|
| 2084 | 2381 | |
|---|
| 2085 | | -static int nvp6188_runtime_suspend(struct device *dev) |
|---|
| 2382 | +static int __maybe_unused nvp6188_runtime_suspend(struct device *dev) |
|---|
| 2086 | 2383 | { |
|---|
| 2087 | 2384 | struct i2c_client *client = to_i2c_client(dev); |
|---|
| 2088 | 2385 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
|---|
| .. | .. |
|---|
| 2125 | 2422 | |
|---|
| 2126 | 2423 | static const struct v4l2_subdev_video_ops nvp6188_video_ops = { |
|---|
| 2127 | 2424 | .s_stream = nvp6188_stream, |
|---|
| 2128 | | - .g_mbus_config = nvp6188_g_mbus_config, |
|---|
| 2425 | + .g_frame_interval = nvp6188_g_frame_interval, |
|---|
| 2129 | 2426 | }; |
|---|
| 2130 | 2427 | |
|---|
| 2131 | 2428 | static const struct v4l2_subdev_pad_ops nvp6188_subdev_pad_ops = { |
|---|
| 2132 | 2429 | .enum_mbus_code = nvp6188_enum_mbus_code, |
|---|
| 2133 | 2430 | .enum_frame_size = nvp6188_enum_frame_sizes, |
|---|
| 2431 | + .enum_frame_interval = nvp6188_enum_frame_interval, |
|---|
| 2134 | 2432 | .get_fmt = nvp6188_get_fmt, |
|---|
| 2135 | 2433 | .set_fmt = nvp6188_set_fmt, |
|---|
| 2434 | + .get_mbus_config = nvp6188_g_mbus_config, |
|---|
| 2136 | 2435 | }; |
|---|
| 2137 | 2436 | |
|---|
| 2138 | 2437 | static const struct v4l2_subdev_core_ops nvp6188_core_ops = { |
|---|
| .. | .. |
|---|
| 2161 | 2460 | int ret; |
|---|
| 2162 | 2461 | u8 val; |
|---|
| 2163 | 2462 | |
|---|
| 2463 | + mutex_lock(&nvp6188->mutex); |
|---|
| 2164 | 2464 | ret = nvp6188_read_reg(client, reg, &val); |
|---|
| 2165 | 2465 | if (ret < 0) { |
|---|
| 2166 | 2466 | dev_err(&client->dev, "%s failed: (%d)\n", __func__, ret); |
|---|
| 2467 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2167 | 2468 | return ret; |
|---|
| 2168 | 2469 | } |
|---|
| 2169 | 2470 | |
|---|
| 2471 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2170 | 2472 | return val; |
|---|
| 2171 | 2473 | } |
|---|
| 2172 | 2474 | |
|---|
| .. | .. |
|---|
| 2178 | 2480 | struct i2c_client *client = nvp6188->client; |
|---|
| 2179 | 2481 | int ret; |
|---|
| 2180 | 2482 | |
|---|
| 2483 | + mutex_lock(&nvp6188->mutex); |
|---|
| 2181 | 2484 | ret = nvp6188_write_reg(client, reg, val); |
|---|
| 2182 | 2485 | if (ret < 0) { |
|---|
| 2183 | 2486 | dev_err(&client->dev, "%s failed: (%d)\n", __func__, ret); |
|---|
| 2487 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2184 | 2488 | return ret; |
|---|
| 2185 | 2489 | } |
|---|
| 2186 | 2490 | |
|---|
| 2491 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2187 | 2492 | return 0; |
|---|
| 2188 | 2493 | } |
|---|
| 2189 | 2494 | |
|---|
| .. | .. |
|---|
| 2204 | 2509 | struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 2205 | 2510 | struct i2c_client *client = nvp6188->client; |
|---|
| 2206 | 2511 | u8 val_rm = 0, val_pb = 0; |
|---|
| 2512 | + int ret = 0; |
|---|
| 2207 | 2513 | |
|---|
| 2514 | + mutex_lock(&nvp6188->mutex); |
|---|
| 2208 | 2515 | nvp6188_write_reg(client, 0xff, 0x01); /* Switch to bank1 for audio */ |
|---|
| 2209 | 2516 | nvp6188_read_reg(client, 0x07, &val_rm); |
|---|
| 2210 | 2517 | nvp6188_read_reg(client, 0x13, &val_pb); |
|---|
| .. | .. |
|---|
| 2219 | 2526 | val_pb &= (~0x80); |
|---|
| 2220 | 2527 | break; |
|---|
| 2221 | 2528 | default: |
|---|
| 2222 | | - return -EINVAL; |
|---|
| 2529 | + ret = -EINVAL; |
|---|
| 2530 | + goto unlock; |
|---|
| 2223 | 2531 | } |
|---|
| 2224 | 2532 | |
|---|
| 2225 | 2533 | /* interface format */ |
|---|
| .. | .. |
|---|
| 2237 | 2545 | val_pb |= 0x03; |
|---|
| 2238 | 2546 | break; |
|---|
| 2239 | 2547 | default: |
|---|
| 2240 | | - return -EINVAL; |
|---|
| 2548 | + ret = -EINVAL; |
|---|
| 2549 | + goto unlock; |
|---|
| 2241 | 2550 | } |
|---|
| 2242 | 2551 | |
|---|
| 2243 | 2552 | /* clock inversion */ |
|---|
| .. | .. |
|---|
| 2251 | 2560 | val_pb |= 0x40; |
|---|
| 2252 | 2561 | break; |
|---|
| 2253 | 2562 | default: |
|---|
| 2254 | | - return -EINVAL; |
|---|
| 2563 | + ret = -EINVAL; |
|---|
| 2564 | + goto unlock; |
|---|
| 2255 | 2565 | } |
|---|
| 2256 | 2566 | |
|---|
| 2257 | 2567 | nvp6188_write_reg(client, 0x07, val_rm); |
|---|
| 2258 | 2568 | nvp6188_write_reg(client, 0x13, val_pb); |
|---|
| 2259 | 2569 | |
|---|
| 2260 | | - return 0; |
|---|
| 2570 | +unlock: |
|---|
| 2571 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2572 | + |
|---|
| 2573 | + return ret; |
|---|
| 2261 | 2574 | } |
|---|
| 2262 | 2575 | |
|---|
| 2263 | 2576 | static int nvp6188_pcm_hw_params(struct snd_pcm_substream *substream, |
|---|
| .. | .. |
|---|
| 2268 | 2581 | struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 2269 | 2582 | struct i2c_client *client = nvp6188->client; |
|---|
| 2270 | 2583 | u8 val = 0; |
|---|
| 2584 | + int ret = 0; |
|---|
| 2271 | 2585 | |
|---|
| 2586 | + mutex_lock(&nvp6188->mutex); |
|---|
| 2272 | 2587 | nvp6188_write_reg(client, 0xff, 0x01); /* Switch to bank1 for audio */ |
|---|
| 2273 | 2588 | |
|---|
| 2274 | 2589 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { |
|---|
| .. | .. |
|---|
| 2282 | 2597 | val &= (~0x04); |
|---|
| 2283 | 2598 | break; |
|---|
| 2284 | 2599 | default: |
|---|
| 2285 | | - return -EINVAL; |
|---|
| 2600 | + ret = -EINVAL; |
|---|
| 2601 | + goto unlock; |
|---|
| 2286 | 2602 | } |
|---|
| 2287 | 2603 | |
|---|
| 2288 | 2604 | switch (params_rate(params)) { |
|---|
| .. | .. |
|---|
| 2296 | 2612 | /* TODO */ |
|---|
| 2297 | 2613 | break; |
|---|
| 2298 | 2614 | default: |
|---|
| 2299 | | - return -EINVAL; |
|---|
| 2615 | + ret = -EINVAL; |
|---|
| 2616 | + goto unlock; |
|---|
| 2300 | 2617 | } |
|---|
| 2301 | 2618 | |
|---|
| 2302 | 2619 | if (nvp6188->audio_out) { |
|---|
| .. | .. |
|---|
| 2313 | 2630 | default: |
|---|
| 2314 | 2631 | dev_err(&client->dev, "Invalid audio_out mclk_fs: %d\n", |
|---|
| 2315 | 2632 | nvp6188->audio_out->mclk_fs); |
|---|
| 2316 | | - return -EINVAL; |
|---|
| 2633 | + ret = -EINVAL; |
|---|
| 2634 | + goto unlock; |
|---|
| 2317 | 2635 | } |
|---|
| 2318 | 2636 | } |
|---|
| 2319 | 2637 | |
|---|
| .. | .. |
|---|
| 2329 | 2647 | val &= (~0x04); |
|---|
| 2330 | 2648 | break; |
|---|
| 2331 | 2649 | default: |
|---|
| 2332 | | - return -EINVAL; |
|---|
| 2650 | + ret = -EINVAL; |
|---|
| 2651 | + goto unlock; |
|---|
| 2333 | 2652 | } |
|---|
| 2334 | 2653 | |
|---|
| 2335 | 2654 | switch (params_rate(params)) { |
|---|
| .. | .. |
|---|
| 2343 | 2662 | /* TODO */ |
|---|
| 2344 | 2663 | break; |
|---|
| 2345 | 2664 | default: |
|---|
| 2346 | | - return -EINVAL; |
|---|
| 2665 | + ret = -EINVAL; |
|---|
| 2666 | + goto unlock; |
|---|
| 2347 | 2667 | } |
|---|
| 2348 | 2668 | |
|---|
| 2349 | 2669 | if (nvp6188->audio_in) { |
|---|
| .. | .. |
|---|
| 2360 | 2680 | default: |
|---|
| 2361 | 2681 | dev_err(&client->dev, "Invalid audio_in mclk_fs: %d\n", |
|---|
| 2362 | 2682 | nvp6188->audio_in->mclk_fs); |
|---|
| 2363 | | - return -EINVAL; |
|---|
| 2683 | + ret = -EINVAL; |
|---|
| 2684 | + goto unlock; |
|---|
| 2364 | 2685 | } |
|---|
| 2365 | 2686 | } |
|---|
| 2366 | 2687 | nvp6188_write_reg(client, 0x07, val); |
|---|
| .. | .. |
|---|
| 2376 | 2697 | default: |
|---|
| 2377 | 2698 | dev_err(&client->dev, "Not supported channels: %d\n", |
|---|
| 2378 | 2699 | params_channels(params)); |
|---|
| 2379 | | - return -EINVAL; |
|---|
| 2700 | + ret = -EINVAL; |
|---|
| 2701 | + goto unlock; |
|---|
| 2380 | 2702 | } |
|---|
| 2381 | 2703 | nvp6188_write_reg(client, 0x08, val); |
|---|
| 2382 | 2704 | } |
|---|
| 2383 | 2705 | |
|---|
| 2384 | | - return 0; |
|---|
| 2706 | +unlock: |
|---|
| 2707 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2708 | + |
|---|
| 2709 | + return ret; |
|---|
| 2385 | 2710 | } |
|---|
| 2386 | 2711 | |
|---|
| 2387 | 2712 | static int nvp6188_pcm_mute(struct snd_soc_dai *dai, int mute, int stream) |
|---|
| .. | .. |
|---|
| 2440 | 2765 | struct nvp6188 *nvp6188 = to_nvp6188(sd); |
|---|
| 2441 | 2766 | struct i2c_client *client = nvp6188->client; |
|---|
| 2442 | 2767 | |
|---|
| 2768 | + mutex_lock(&nvp6188->mutex); |
|---|
| 2443 | 2769 | nvp6188_write_reg(client, 0xff, 0x01); /* Switch to bank1 for audio */ |
|---|
| 2770 | + mutex_unlock(&nvp6188->mutex); |
|---|
| 2444 | 2771 | return snd_soc_get_volsw(kcontrol, ucontrol); |
|---|
| 2445 | 2772 | } |
|---|
| 2446 | 2773 | |
|---|
| .. | .. |
|---|
| 2826 | 3153 | pm_runtime_enable(dev); |
|---|
| 2827 | 3154 | pm_runtime_idle(dev); |
|---|
| 2828 | 3155 | |
|---|
| 3156 | + nvp6188_video_init(nvp6188); |
|---|
| 3157 | + |
|---|
| 2829 | 3158 | return 0; |
|---|
| 2830 | 3159 | |
|---|
| 2831 | 3160 | err_clean_entity: |
|---|
| .. | .. |
|---|
| 2862 | 3191 | return 0; |
|---|
| 2863 | 3192 | } |
|---|
| 2864 | 3193 | |
|---|
| 2865 | | -static const struct dev_pm_ops nvp6188_pm_ops = { |
|---|
| 3194 | +static const struct dev_pm_ops __maybe_unused nvp6188_pm_ops = { |
|---|
| 2866 | 3195 | SET_RUNTIME_PM_OPS(nvp6188_runtime_suspend, |
|---|
| 2867 | 3196 | nvp6188_runtime_resume, NULL) |
|---|
| 2868 | 3197 | }; |
|---|
| .. | .. |
|---|
| 2883 | 3212 | static struct i2c_driver nvp6188_i2c_driver = { |
|---|
| 2884 | 3213 | .driver = { |
|---|
| 2885 | 3214 | .name = NVP6188_NAME, |
|---|
| 2886 | | - .pm = &nvp6188_pm_ops, |
|---|
| 3215 | + //.pm = &nvp6188_pm_ops, |
|---|
| 2887 | 3216 | .of_match_table = of_match_ptr(nvp6188_of_match), |
|---|
| 2888 | 3217 | }, |
|---|
| 2889 | 3218 | .probe = &nvp6188_probe, |
|---|
| .. | .. |
|---|
| 2891 | 3220 | .id_table = nvp6188_match_id, |
|---|
| 2892 | 3221 | }; |
|---|
| 2893 | 3222 | |
|---|
| 2894 | | -static int __init sensor_mod_init(void) |
|---|
| 3223 | +int nvp6188_sensor_mod_init(void) |
|---|
| 2895 | 3224 | { |
|---|
| 2896 | 3225 | return i2c_add_driver(&nvp6188_i2c_driver); |
|---|
| 2897 | 3226 | } |
|---|
| 3227 | + |
|---|
| 3228 | +#ifndef CONFIG_VIDEO_REVERSE_IMAGE |
|---|
| 3229 | +device_initcall_sync(nvp6188_sensor_mod_init); |
|---|
| 3230 | +#endif |
|---|
| 2898 | 3231 | |
|---|
| 2899 | 3232 | static void __exit sensor_mod_exit(void) |
|---|
| 2900 | 3233 | { |
|---|
| 2901 | 3234 | i2c_del_driver(&nvp6188_i2c_driver); |
|---|
| 2902 | 3235 | } |
|---|
| 2903 | 3236 | |
|---|
| 2904 | | -device_initcall_sync(sensor_mod_init); |
|---|
| 2905 | 3237 | module_exit(sensor_mod_exit); |
|---|
| 2906 | 3238 | |
|---|
| 2907 | 3239 | MODULE_AUTHOR("Vicent Chi <vicent.chi@rock-chips.com>"); |
|---|