This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM5728: Adding v4l2_subdev_init and v4l2_async_register_subdev kernel panic happening

Part Number: AM5728

Hai sir,

I am using AM5728 custom board through spi we are connected GS2971 serializer.

From SPI Internal register able to read the gs2971 register data(Mode:HD,Pixels count:1920,etc.., ) all gs2971 data we are able to read.

To the Oscilloscope we are capturing HSYNC,VSYNC,DIN0 data properly getting 74.25 MHz.

we are loading the driver gs2971.c from git website:https://github.com/HIO-Project/linux-imx6-nano-imx_3.10.17_1.0.1_ga/blob/master/drivers/media/platform/mxc/capture/gs2971.c

In that driver we added registers reading the default values properly getting.

In the GS2971 driver calling v4l2_int_device_register(&gs2971_int_device); function after that i am not receiving any data.

Then i added two functions based on the thread e2e.ti.com/.../2110750

ret = v4l2_async_register_subdev(sd);
v4l2_subdev_init(sd, ops);

But getting KERNEL PANIC while booting the device.

below error getting

[ 4.346706] gs2971_gpio_state: active=1, standby-gpios(0)=0x1
[ 4.352490] Unable to handle kernel NULL pointer dereference at virtual address 00000050
[ 4.360632] pgd = 8c2fcd49
[ 4.363349] [00000050] *pgd=80000080004003, *pmd=00000000
[ 4.368800] Internal error: Oops: a06 [#1] PREEMPT SMP ARM
[ 4.374308] Modules linked in:
[ 4.377383] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.59-g5f8c1c6121 #31
[ 4.384549] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 4.390676] PC is at v4l2_subdev_init+0x14/0x60
[ 4.395230] LR is at gs2971_probe+0x3f8/0x420
[ 4.399605] pc : [<c07d2dd0>] lr : [<c07e569c>] psr: 60000013
[ 4.405898] sp : ef08fd40 ip : ef08fd50 fp : ef08fd4c
[ 4.411144] r10: c0e4491c r9 : c0e44950 r8 : 00000000
[ 4.416391] r7 : c1204c48 r6 : c1290d1c r5 : ee4cd000 r4 : ee456400
[ 4.422945] r3 : 00000050 r2 : 00000000 r1 : 00000000 r0 : 00000000
[ 4.429501] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 4.436667] Control: 30c5387d Table: 80003000 DAC: fffffffd
[ 4.442437] Process swapper/0 (pid: 1, stack limit = 0x5e636b59)
[ 4.448469] Stack: (0xef08fd40 to 0xef090000)
[ 4.452847] fd40: ef08fd8c ef08fd50 c07e569c c07d2dc8 000000c0 c03c6850 00010040 fc08bb2e
[ 4.461061] fd60: 00000000 ee456400 00000000 c124296c 00000000 00000000 c124297c 00000000
[ 4.469276] fd80: ef08fdac ef08fd90 c074b6ec c07e52b0 c128f2b0 ee456400 c128f2b4 00000000
[ 4.477489] fda0: ef08fddc ef08fdb0 c06b2f90 c074b674 00000000 ee456400 c124297c ee456434
[ 4.485704] fdc0: c06b3308 00000000 c104c834 c10626e0 ef08fe14 ef08fde0 c06b31f0 c06b2d98
[ 4.493918] fde0: c084d890 c084b6b0 ef08fe14 ef08fdf8 ee456400 c124297c ee456434 c06b3308
[ 4.502132] fe00: 00000000 c104c834 ef08fe34 ef08fe18 c06b33ec c06b3194 eeb3fbb4 c1204c48
[ 4.510346] fe20: c124297c c06b3308 ef08fe64 ef08fe38 c06b1080 c06b3314 ef08fe70 ef209958
[ 4.518558] fe40: eeb3fbb4 fc08bb2e c124297c c123c358 ee4cb100 00000000 ef08fe74 ef08fe68
[ 4.526772] fe60: c06b28c8 c06b1010 ef08fe9c ef08fe78 c06b2364 c06b28b0 c0e449a4 ef08fe88
[ 4.534985] fe80: c124297c c1204c48 ffffe000 c102e05c ef08feb4 ef08fea0 c06b3dd0 c06b21ac
[ 4.543198] fea0: c1254100 c1204c48 ef08fec4 ef08feb8 c074b628 c06b3d60 ef08fed4 ef08fec8
[ 4.551412] fec0: c102e074 c074b5d4 ef08ff4c ef08fed8 c02025b8 c102e068 00000000 c0dd2c7c
[ 4.559625] fee0: c0dd2c5c c0dd2c00 c0ddeafc c1204c48 00000000 c0dd2c34 00000006 00000006
[ 4.567839] ff00: 00000000 c0e37e9c c10004f0 c0eb8b44 ef08ff34 ef658044 00000000 fc08bb2e
[ 4.576052] ff20: 00000000 fc08bb2e c1254100 00000007 c1254100 c1254100 c10004f0 c104c854
[ 4.584265] ff40: ef08ff94 ef08ff50 c1000ff4 c0202540 00000006 00000006 00000000 c10004f0
[ 4.592479] ff60: c0eb8b44 000000e7 ffffe000 00000000 c0a1c518 00000000 00000000 00000000
[ 4.600693] ff80: 00000000 00000000 ef08ffac ef08ff98 c0a1c528 c1000e3c 00000000 c0a1c518
[ 4.608907] ffa0: 00000000 ef08ffb0 c02010d8 c0a1c524 00000000 00000000 00000000 00000000
[ 4.617121] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 4.625335] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[ 4.633545] Backtrace:
[ 4.636012] [<c07d2dbc>] (v4l2_subdev_init) from [<c07e569c>] (gs2971_probe+0x3f8/0x420)
[ 4.644145] [<c07e52a4>] (gs2971_probe) from [<c074b6ec>] (spi_drv_probe+0x84/0xa8)
[ 4.651838] r10:00000000 r9:c124297c r8:00000000 r7:00000000 r6:c124296c r5:00000000
[ 4.659700] r4:ee456400
[ 4.662251] [<c074b668>] (spi_drv_probe) from [<c06b2f90>] (really_probe+0x204/0x2c0)
[ 4.670116] r7:00000000 r6:c128f2b4 r5:ee456400 r4:c128f2b0
[ 4.675805] [<c06b2d8c>] (really_probe) from [<c06b31f0>] (driver_probe_device+0x68/0x180)
[ 4.684107] r10:c10626e0 r9:c104c834 r8:00000000 r7:c06b3308 r6:ee456434 r5:c124297c
[ 4.691970] r4:ee456400 r3:00000000
[ 4.695565] [<c06b3188>] (driver_probe_device) from [<c06b33ec>] (__driver_attach+0xe4/0xe8)
[ 4.704042] r9:c104c834 r8:00000000 r7:c06b3308 r6:ee456434 r5:c124297c r4:ee456400
[ 4.711824] [<c06b3308>] (__driver_attach) from [<c06b1080>] (bus_for_each_dev+0x7c/0xbc)
[ 4.720037] r7:c06b3308 r6:c124297c r5:c1204c48 r4:eeb3fbb4
[ 4.725726] [<c06b1004>] (bus_for_each_dev) from [<c06b28c8>] (driver_attach+0x24/0x28)
[ 4.733765] r7:00000000 r6:ee4cb100 r5:c123c358 r4:c124297c
[ 4.739452] [<c06b28a4>] (driver_attach) from [<c06b2364>] (bus_add_driver+0x1c4/0x208)
[ 4.747495] [<c06b21a0>] (bus_add_driver) from [<c06b3dd0>] (driver_register+0x7c/0x110)
[ 4.755621] r7:c102e05c r6:ffffe000 r5:c1204c48 r4:c124297c
[ 4.761309] [<c06b3d54>] (driver_register) from [<c074b628>] (__spi_register_driver+0x60/0x64)
[ 4.769957] r5:c1204c48 r4:c1254100
[ 4.773554] [<c074b5c8>] (__spi_register_driver) from [<c102e074>] (gs2971_init+0x18/0x20)
[ 4.781858] [<c102e05c>] (gs2971_init) from [<c02025b8>] (do_one_initcall+0x84/0x1b0)
[ 4.789729] [<c0202534>] (do_one_initcall) from [<c1000ff4>] (kernel_init_freeable+0x1c4/0x258)
[ 4.798465] r8:c104c854 r7:c10004f0 r6:c1254100 r5:c1254100 r4:00000007
[ 4.805202] [<c1000e30>] (kernel_init_freeable) from [<c0a1c528>] (kernel_init+0x10/0x11c)
[ 4.813504] r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0a1c518
[ 4.821365] r4:00000000
[ 4.823912] [<c0a1c518>] (kernel_init) from [<c02010d8>] (ret_from_fork+0x14/0x3c)
[ 4.831513] Exception stack(0xef08ffb0 to 0xef08fff8)
[ 4.836586] ffa0: 00000000 00000000 00000000 00000000
[ 4.844800] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 4.853013] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000
[ 4.859655] r5:c0a1c518 r4:00000000
[ 4.863247] Code: e92dd800 e24cb004 e3510000 e2803050 (e5803050)
[ 4.869407] ---[ end trace 6f6d891c556030af ]---
[ 4.874060] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 4.874060]
[ 4.883244] CPU1: stopping
[ 4.885968] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D 4.19.59-g5f8c1c6121 #31
[ 4.894530] Hardware name: Generic DRA74X (Flattened Device Tree)
[ 4.900647] Backtrace:
[ 4.903114] [<c020ca34>] (dump_backtrace) from [<c020cd6c>] (show_stack+0x18/0x1c)
[ 4.910719] r7:ef0c5f08 r6:60000193 r5:00000000 r4:c12509dc
[ 4.916407] [<c020cd54>] (show_stack) from [<c0a082a0>] (dump_stack+0x90/0xa4)
[ 4.923665] [<c0a08210>] (dump_stack) from [<c020f6b8>] (handle_IPI+0x1b0/0x1dc)
[ 4.931095] r7:ef0c5f08 r6:00000001 r5:00000000 r4:c106acfc
[ 4.936784] [<c020f508>] (handle_IPI) from [<c05513e4>] (gic_handle_irq+0x7c/0x80)
[ 4.944386] r6:fa212000 r5:fa21200c r4:c1205100
[ 4.949027] [<c0551368>] (gic_handle_irq) from [<c02019f8>] (__irq_svc+0x58/0x8c)
[ 4.956540] Exception stack(0xef0c5f08 to 0xef0c5f50)
[ 4.961614] 5f00: 00000000 000006b4 ef64950c c021a960 ffffe000 c1204c7c
[ 4.969828] 5f20: c1204cc4 00000002 00000000 00000000 c106a4f0 ef0c5f64 ef0c5f68 ef0c5f58
[ 4.978040] 5f40: c0208ea8 c0208eac 60000013 ffffffff
[ 4.983115] r9:ef0c4000 r8:00000000 r7:ef0c5f3c r6:ffffffff r5:60000013 r4:c0208eac
[ 4.990899] [<c0208e6c>] (arch_cpu_idle) from [<c0a2222c>] (default_idle_call+0x30/0x34)
[ 4.999029] [<c0a221fc>] (default_idle_call) from [<c025a5e0>] (do_idle+0x20c/0x2b4)
[ 5.006810] [<c025a3d4>] (do_idle) from [<c025a974>] (cpu_startup_entry+0x20/0x24)
[ 5.014414] r10:00000000 r9:412fc0f2 r8:80007000 r7:c1254390 r6:00000001 r5:ef0c4000
[ 5.022276] r4:00000087
[ 5.024824] [<c025a954>] (cpu_startup_entry) from [<c020f25c>] (secondary_start_kernel+0x174/0x180)
[ 5.033913] [<c020f0e8>] (secondary_start_kernel) from [<8020236c>] (0x8020236c)
[ 5.041341] r7:c1254390 r6:30c0387d r5:00000000 r4:af077180
[ 5.047032] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[ 5.047032] ]---

My DTS entries are:

&vip2{
            status="okay";
};
&vin3a {
           status = "okay";
    vin3a_ep: endpoint {
        remote-endpoint = <&gs2971_cam0>;
        slave-mode;
    };
};
&mcspi3{
    status="okay";
    pinctrl-names = "default";
//    pinctrl-0 = <&spi3_pins_default>;
    ti,pindir-d0-out-d1-in;
    bus-num=<3>;   
    
    gs2971: gs2971@2 {
        compatible = "gn,gs2971";
        reg = <2>;
        bits_per_word=<16>;
        mclk = <27000000>;
        csi = <1>;
        cea861 = <0>;
        ipu_id = <1234>;
        spi-max-frequency = <6000000>;
        //port {
        //#address-cells = <1>;
        //#size-cells = <0>;
        port {        
            gs2971_cam0: endpoint {
            remote-endpoint = <&vin3a>;
            hsync-active = <1>;
            vsync-active = <1>;
            pixel-clock-freq = <74250000>;    //750khZ
                    //input-clock-freq = <74250000>;
            pclk-sample = <1>;
                data-shift = <0>;
            bus-width = <16>;    
            };
        };
    };
};

MY CONFIG Entries are:

CONFIG_MEDIA_CAMERA_SUPPORT=y
CONFIG_MEDIA_CEC_SUPPORT=y
CONFIG_MEDIA_CONTROLLER=y
CONFIG_VIDEO_DEV=y
CONFIG_VIDEO_V4L2_SUBDEV_API=y
CONFIG_VIDEO_V4L2=y
CONFIG_V4L2_MEM2MEM_DEV=y
CONFIG_V4L2_FWNODE=y
CONFIG_VIDEO_V4L2_INT_DEVICE=y        #cispl

CONFIG_VIDEOBUF2_CORE=y
CONFIG_VIDEOBUF2_V4L2=y
CONFIG_VIDEOBUF2_MEMOPS=y
CONFIG_VIDEOBUF2_DMA_CONTIG=y
CONFIG_VIDEOBUF2_VMALLOC=m
CONFIG_VIDEO_V4L2_TPG=m

And am attaching my driver and boot log also

How to add v4l2_subdev_init() directly instead of v4l2_i2c_subdev_init() (after adding) this we are getting kernel panic error.

/* SEMTECH SD SDI reciever
 *
 * Copyright (C) 2014 RidgeRun
 * Author: Edison Fernández <edison.fernández@ridgerun.com>
 *
 * Currently working with 1080p30 and 720p60 with no audio support.
 * In order to support more standars the VD_STD value should be
 * used in order to identify the incomming resolution and framerate.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */

/*!
 * @file gs2971.c
 *
 * @brief SEMTECH SD SDI reciever
 *
 * @ingroup Camera
 */

#include <linux/module.h>
#include <linux/init.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/device.h>
#include <linux/i2c.h>
#include <linux/of_gpio.h>
#include <linux/videodev2.h>
#include <linux/regulator/consumer.h>
#include <linux/fsl_devices.h>
#include <media/v4l2-chip-ident.h>
#include <media/v4l2-int-device.h>
#include "mxc_v4l2_capture.h"
#include <linux/proc_fs.h>

#include <media/v4l2-async.h>
#include <media/v4l2-device.h>
#include <media/v4l2-common.h>
#include <media/v4l2-mediabus.h>
//#include <media/v4l2-of.h>
#include <media/v4l2-ctrls.h>
#include <media/media-entity.h>
#include <linux/videodev2.h>

#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
#include <media/v4l2-event.h>
#include <media/v4l2-image-sizes.h>
#include <media/v4l2-subdev.h>
#include <media/v4l2-mediabus.h>
#include <media/v4l2-common.h>
//#include <media/v4l2-of.h>
#include <media/v4l2-dv-timings.h>
#include <media/v4l2-ioctl.h>

#include "gs2971.h"

#define DEBUG 1
#define DRIVER_NAME     "gs2971"

/* Debug functions */
static int debug = 1;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "Debug level (0-2)");

static struct gs2971_spidata *spidata;

#define YUV_FORMAT(gs) ((gs->cea861) ? V4L2_PIX_FMT_UYVY : V4L2_PIX_FMT_YUYV)

/*! @brief This mutex is used to provide mutual exclusion.
 *
 *  Create a mutex that can be used to provide mutually exclusive
 *  read/write access to the globally accessible data structures
 *  and variables that were defined above.
 */
static DEFINE_MUTEX(mutex);

int gs2971_read_buffer(struct spi_device *spi, u16 offset, u16 * values,
		       int length)
{
	struct spi_message msg;
	struct spi_transfer spi_xfer;
	int status;
	struct gs2971_spidata *sp = spidata;

	if (!spi)
		return -ENODEV;

	if (length > GS2971_SPI_TRANSFER_MAX)
		return -EINVAL;

	sp->txbuf[0] = 0x8000 | (offset & 0xfff);	/* read */
	if (length > 1)
		sp->txbuf[0] |= 0x1000;	/* autoinc */

	memset(&spi_xfer, '\0', sizeof(spi_xfer));
	spi_xfer.tx_buf = sp->txbuf;
	spi_xfer.rx_buf = sp->rxbuf;
	spi_xfer.bits_per_word = 16;
	spi_xfer.delay_usecs = 0;
	spi_xfer.speed_hz = 1000000;
	spi_xfer.len = sizeof(*values) * (length + 1);	// length in bytes

	spi_message_init(&msg);
	spi_message_add_tail(&spi_xfer, &msg);

	status = spi_sync(spi, &msg);
	
	memcpy(values, &sp->rxbuf[1], sizeof(*values) * length);
	if (status)
		pr_err(">> Read buffer(%d) (%x): %x %x, %x %x\n", status,
		       offset, sp->txbuf[0], sp->txbuf[1], sp->rxbuf[0],
		       sp->rxbuf[1]);

	return status;
}

int gs2971_read_register(struct spi_device *spi, u16 offset, u16 * value)
{
	struct spi_message msg;
	struct spi_transfer spi_xfer;
	int status;
	u32 txbuf[1];
	u32 rxbuf[1];

	if (!spi)
		return -ENODEV;

	txbuf[0] = 0x80000000 | ((offset & 0xfff) << 16);	/* read */


	memset(&spi_xfer, '\0', sizeof(spi_xfer));
	spi_xfer.tx_buf = txbuf;
	spi_xfer.rx_buf = rxbuf;
	spi_xfer.bits_per_word = 32;	
	spi_xfer.delay_usecs = 0;	
	spi_xfer.speed_hz = 1000000;
	spi_xfer.len = 4;	// length in bytes

	spi_message_init(&msg);
	spi_message_add_tail(&spi_xfer, &msg);

	status = spi_sync(spi, &msg);

	//dev_err(&spi->dev, "read_register status=%x\n", status);	//cispl
	if (status) {
		dev_dbg(&spi->dev, "read_reg failed\n");
		*value = 0xffff;
	} else {
		*value = (u16) rxbuf[0];
	}

	if (status)
		pr_err(">> Read register(%d) (%x): %x, %x\n", status, offset,
		       txbuf[0], rxbuf[0]);

	pr_debug("--> Read register (%x) with value: %x", offset, *value);
	return status;
}

int gs2971_write_buffer(struct spi_device *spi, u16 offset, u16 * values,
			int length)
{
	struct spi_message msg;
	struct spi_transfer spi_xfer;
	int status;
	struct gs2971_spidata *sp = spidata;

	if (!spi)
		return -ENODEV;

	if (length > GS2971_SPI_TRANSFER_MAX - 1)
		return -EINVAL;

	sp->txbuf[0] = (offset & 0xfff);	/* write  */
	if (length > 1)
		sp->txbuf[0] |= 0x1000;	/* autoinc */
	memcpy(&sp->txbuf[1], values, sizeof(*values) * length);

	memset(&spi_xfer, '\0', sizeof(spi_xfer));
	spi_xfer.tx_buf = sp->txbuf;
	spi_xfer.rx_buf = sp->rxbuf;
	spi_xfer.bits_per_word = 16;
	spi_xfer.delay_usecs = 0;
	spi_xfer.speed_hz = 1000000;
	spi_xfer.len = sizeof(*values) * (length + 1);	// length in bytes

	spi_message_init(&msg);
	spi_message_add_tail(&spi_xfer, &msg);

	status = spi_sync(spi, &msg);
	if (status)
		pr_err(">> Write register(%d) (%x): %x %x, %x %x\n", status,
		       offset, sp->txbuf[0], sp->txbuf[1], sp->rxbuf[0],
		       sp->rxbuf[1]);
	return status;
}

int gs2971_write_register(struct spi_device *spi, u16 offset, u16 value)
{
	pr_debug("--> Writing to address (%x) : %x\n", offset, value);
	return gs2971_write_buffer(spi, offset, &value, 1);
}
const char *gpio_names[] = {
[GPIO_STANDBY] = "standby-gpios",
[GPIO_RESET] = "rst-gpios",
[GPIO_TIM_861] = "tim_861-gpios",
[GPIO_IOPROC_EN] = "ioproc_en-gpios",
[GPIO_SW_EN] = "sw_en-gpios",
[GPIO_RC_BYPASS] = "rc_bypass-gpios",
[GPIO_AUDIO_EN] = "audio_en-gpios",
[GPIO_DVB_ASI] = "dvb_asi-gpios",
[GPIO_SMPTE_BYPASS] = "smpte_bypass-gpios",
[GPIO_DVI_LOCK] = "dvi_lock-gpios",
[GPIO_DATA_ERR] = "data_err-gpios",
[GPIO_LB_CONT] = "lb_cont-gpios",
[GPIO_Y_1ANC] = "y_1anc-gpios",
};

void gs2971_gpio_state(struct gs2971_priv *gs, int index, int active)
{
	if (gpio_is_valid(gs->gpios[index])) {
		int state = (gs->gpio_flags[index] & OF_GPIO_ACTIVE_LOW) ? 1 : 0;

		state ^= active;
		gpio_set_value(gs->gpios[index], state);
		pr_info("%s: active=%d, %s(%d)=0x%x\n", __func__, active, gpio_names[index], gs->gpios[index], state);
	}
}

static void gs2971_change_gpio_state(struct gs2971_priv *gs, int on)
{
	gs2971_gpio_state(gs, GPIO_STANDBY, on ? 0 : 1);
	if (on) {
		pr_debug("%s: power up delay\n", __func__);
		msleep(1000);
	}
}

static int gs2971_get_gpios(struct gs2971_priv *gs, struct device *dev)
{
	int i;
	int ret;
	enum of_gpio_flags flags;

	for (i = 0; i < GPIO_CNT; i++) {
		gs->gpios[i] = of_get_named_gpio_flags(dev->of_node, gpio_names[i], 0, &flags);
		if (!gpio_is_valid(gs->gpios[i])) {
			pr_info("%s: gpio %s not available\n", __func__, gpio_names[i]);
		} else {
			int gflags = (flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;

			if ((i == GPIO_STANDBY) || (i == GPIO_RESET))
				gflags ^= GPIOF_INIT_HIGH;
			if (flags == 2)
				gflags = GPIOF_IN;

			gs->gpio_flags[i] = flags;
			pr_info("%s: %s flags(%d -> %d)\n", __func__, gpio_names[i], flags, gflags);
			ret = devm_gpio_request_one(dev, gs->gpios[i], gflags, gpio_names[i]);
			if (ret < 0) {
				pr_info("%s: request of %s failed(%d)\n", __func__, gpio_names[i], ret);
				return ret;
			}
		}
	}
	gs2971_gpio_state(gs, GPIO_IOPROC_EN, 1);	//active ioproc_en
	msleep(2);
	gs2971_gpio_state(gs, GPIO_RESET, 0);	//remove reset
	msleep(400);
	return 0;
}

static s32 power_control(struct gs2971_priv *gs, int on)
{
	struct sensor_data *sensor = &gs->sensor;
	int i;
	int ret = 0;

	pr_debug("%s: %d\n", __func__, on);
	if (sensor->on != on) {
		if (on) {
			for (i = 0; i < REGULATOR_CNT; i++) {
				if (gs->regulator[i]) {
					ret = regulator_enable(gs->regulator[i]);
					if (ret) {
						pr_err("%s:regulator_enable failed(%d)\n",
							__func__, ret);
						on = 0;	/* power all off */
						break;
					}
				}
			}
		}
		gs2971_change_gpio_state(gs, on);
		sensor->on = on;
		if (!on) {
			for (i = REGULATOR_CNT - 1; i >= 0; i--) {
				if (gs->regulator[i])
					regulator_disable(gs->regulator[i]);
			}
		}
	}
	return ret;
}

static struct spi_device *gs2971_get_spi(struct gs2971_spidata *spidata)
{
	if (!spidata)
		return NULL;
	return spidata->spi;
}

static int get_std(struct v4l2_int_device *s, v4l2_std_id * id)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;
	struct spi_device *spi = NULL;
	u16 std_lock_value;
	u16 sync_lock_value;
	u16 words_per_actline_value;
	u16 words_per_line_value;
	u16 lines_per_frame_value;
	u16 actlines_per_frame_value;
	u16 interlaced_flag;
	int status;
	u16 sd_audio_status_value;
	u16 hd_audio_status_value;
	u16 sd_audio_config_value;
	u16 hd_audio_config_value;
	u16 readback_value;
	u16 ds1, ds2;

	pr_debug("-> In function %s\n", __func__);

	gs->mode = gs2971_mode_not_supported;
	gs->framerate = gs2971_default_fps;

	spi = gs2971_get_spi(spidata);
	if (!spi)
		return -ENODEV;

	*id = V4L2_STD_UNKNOWN;

	status =
	    gs2971_read_register(spi, GS2971_RASTER_STRUCT4, &std_lock_value);
	actlines_per_frame_value = std_lock_value & GS_RS4_ACTLINES_PER_FIELD;
	interlaced_flag = std_lock_value & GS_RS4_INT_nPROG;

	status =
	    gs2971_read_register(spi, GS2971_FLYWHEEL_STATUS, &sync_lock_value);
	if (status)
		return status;
	pr_debug("--> lock_value %x\n", sync_lock_value);
	if (!sync_lock_value) {
		pr_err("%s: no lock, gs2971\n", __func__);
		return -EBUSY;
	}

	status = gs2971_read_register(spi, GS2971_DATA_FORMAT_DS1, &ds1);
	if (status)
		return status;
	status = gs2971_read_register(spi, GS2971_DATA_FORMAT_DS2, &ds2);
	if (status)
		return status;
	pr_debug("--> ds1=%x\n--> ds2=%x\n", ds1, ds2);

	status =
	    gs2971_read_register(spi, GS2971_RASTER_STRUCT1,
				 &words_per_actline_value);
	if (status)
		return status;
	words_per_actline_value &= GS_RS1_WORDS_PER_ACTLINE;

	status =
	    gs2971_read_register(spi, GS2971_RASTER_STRUCT2,
				 &words_per_line_value);
	if (status)
		return status;
	words_per_line_value &= GS_RS2_WORDS_PER_LINE;

	status =
	    gs2971_read_register(spi, GS2971_RASTER_STRUCT3,
				 &lines_per_frame_value);
	if (status)
		return status;
	lines_per_frame_value &= GS_RS3_LINES_PER_FRAME;

	pr_debug("--> Words per line %u/%u Lines per frame %u/%u\n",
		 (unsigned int)words_per_actline_value,
		 (unsigned int)words_per_line_value,
		 (unsigned int)actlines_per_frame_value,
		 (unsigned int)lines_per_frame_value);
	pr_debug("--> SyncLock: %s %s StdLock: 0x%04x\n",
		 (sync_lock_value & GS_FLY_V_LOCK_DS1) ? "Vsync" : "NoVsync",
		 (sync_lock_value & GS_FLY_H_LOCK_DS1) ? "Hsync" : "NoHsync",
		 (unsigned int)(std_lock_value));

	status =
	    gs2971_read_register(spi, GS2971_CH_VALID, &sd_audio_status_value);
	if (status)
		return status;

	status =
	    gs2971_read_register(spi, GS2971_HD_CH_VALID,
				 &hd_audio_status_value);
	if (status)
		return status;

	if (!lines_per_frame_value) {
		pr_err("%s: 0 frame size\n", __func__);
		return -EBUSY;
	}

	if (gs->cea861) {
		sensor->spix.swidth = words_per_line_value - 1;
		sensor->spix.sheight = lines_per_frame_value;
	}
	if (interlaced_flag && lines_per_frame_value == 525) {
		pr_debug("--> V4L2_STD_525_60\n");
		*id = V4L2_STD_525_60;
	} else if (interlaced_flag && lines_per_frame_value == 625) {
		pr_debug("--> V4L2_STD_625_50\n");
		*id = V4L2_STD_625_50;
	} else if (interlaced_flag && lines_per_frame_value == 525) {
		pr_debug("--> V4L2_STD_525P_60\n");
		*id = YUV_FORMAT(gs);
	} else if (interlaced_flag && lines_per_frame_value == 625) {
		pr_debug("--> V4L2_STD_625P_50\n");
		*id = YUV_FORMAT(gs);
	} else if (!interlaced_flag && 749 <= lines_per_frame_value
		   && lines_per_frame_value <= 750) {
		if (gs->cea861) {
			sensor->spix.left = 220;
			sensor->spix.top = 25;
		}
		sensor->pix.width = 1280;
		sensor->pix.height = 720;
		if (words_per_line_value > 1650) {
			pr_debug("--> V4L2_STD_720P_50\n");
			*id = YUV_FORMAT(gs);
		} else {
			pr_debug("--> V4L2_STD_720P_60\n");
			gs->mode = gs2971_mode_720p;
			gs->framerate = gs2971_60_fps;
			*id = YUV_FORMAT(gs);
		}
	} else if (!interlaced_flag && 1124 <= lines_per_frame_value
		   && lines_per_frame_value <= 1125) {
		sensor->pix.width = 1920;
		sensor->pix.height = 1080;
		gs->mode = gs2971_mode_1080p;
		gs->framerate = gs2971_30_fps;	// Currently only 1080p30 is supported

		if (words_per_line_value >= 2200 + 550) {
			pr_debug("--> V4L2_STD_1080P_24\n");
			*id = YUV_FORMAT(gs);
		} else if (words_per_line_value >= 2200 + 440) {
			pr_debug("--> V4L2_STD_1080P_25\n");
			*id = YUV_FORMAT(gs);
		} else {
			pr_debug("--> V4L2_STD_1080P_60\n");
			*id = YUV_FORMAT(gs);
		}
	} else if (interlaced_flag && 1124 <= lines_per_frame_value
		   && lines_per_frame_value <= 1125) {

		sensor->pix.width = 1920;
		sensor->pix.height = 1080;
		if (words_per_line_value >= 2200 + 440) {
			pr_debug("--> V4L2_STD_1080I_50\n");
			*id = YUV_FORMAT(gs);
		} else {
			pr_debug("--> V4L2_STD_1080I_60\n");
			*id = YUV_FORMAT(gs);
		}
	} else {
		dev_err(&spi->dev,
			"Std detection failed: interlaced_flag: %u words per line %u/%u Lines per frame %u/%u SyncLock: %s %s StdLock: 0x%04x\n",
			(unsigned int)interlaced_flag,
			(unsigned int)words_per_actline_value,
			(unsigned int)words_per_line_value,
			(unsigned int)actlines_per_frame_value,
			(unsigned int)lines_per_frame_value,
			(sync_lock_value & GS_FLY_V_LOCK_DS1) ? "Vsync" :
			"NoVsync",
			(sync_lock_value & GS_FLY_H_LOCK_DS1) ? "Hsync" :
			"NoHsync", (unsigned int)(std_lock_value));
		return -1;
	}

	sd_audio_config_value = 0xaaaa;	// 16-bit, right-justified

	status =
	    gs2971_write_register(spi, GS2971_CFG_AUD, sd_audio_config_value);
	if (!status) {
		status =
		    gs2971_read_register(spi, GS2971_CFG_AUD, &readback_value);
		if (!status) {
			if (sd_audio_config_value != readback_value) {
				dev_dbg(&spi->dev,
					"SD audio readback failed, wanted x%04x, got x%04x\n",
					(unsigned int)sd_audio_config_value,
					(unsigned int)readback_value);
			}
		}
	}

	hd_audio_config_value = 0x0aa4;	// 16-bit, right-justified
	status =
	    gs2971_write_register(spi, GS2971_HD_CFG_AUD,
				  hd_audio_config_value);
	if (!status) {
		status =
		    gs2971_read_register(spi, GS2971_HD_CFG_AUD,
					 &readback_value);
		if (!status) {
			if (hd_audio_config_value != readback_value) {
				dev_dbg(&spi->dev,
					"HD audio readback failed, wanted x%04x, got x%04x\n",
					(unsigned int)hd_audio_config_value,
					(unsigned int)readback_value);
			}
		}
	}

	status =
	    gs2971_write_register(spi, GS2971_ANC_CONTROL, ANCCTL_ANC_DATA_DEL);
	if (status)
		return status;
	pr_debug("--> remove anc data\n");

#if 0
	status = gs2971_write_register(spi, GS2971_ACGEN_CTRL,
				       (GS2971_ACGEN_CTRL_SCLK_INV_MASK |
					GS2971_ACGEN_CTRL_MCLK_SEL_128FS));
#endif
	return 0;
}

static void gs2971_workqueue_handler(struct work_struct *data);

DECLARE_WORK(gs2971_worker, gs2971_workqueue_handler);

static void gs2971_workqueue_handler(struct work_struct *ignored)
{
	struct spi_device *spi;
	u16 bank_reg_base, anc_reg;
	static u16 anc_buf[257];
	int anc_length;
	int adf_found = 1;
	int ch_id;
	int status;
	u16 did, sdid;

	pr_debug("-> In function %s\n", __func__);

	for (ch_id = 0; ch_id < GS2971_NUM_CHANNELS; ch_id++) {

		spi = gs2971_get_spi(spidata);
		if (!spi)
			continue;

		/* Step 2: start writing to other bank */
		gs2971_write_register(spi, GS2971_ANC_CONTROL,
				      ANCCTL_ANC_DATA_DEL |
				      ANCCTL_ANC_DATA_SWITCH);

#if 1
		/* Step 1: read ancillary data */
		bank_reg_base = GS2971_ANC_BANK_REG;
		status = 0;
		for (anc_reg = bank_reg_base, adf_found = 1; (0 == status) &&
		     ((anc_reg + 6) < bank_reg_base + GS2971_ANC_BANK_SIZE);) {
			status = gs2971_read_buffer(spi, anc_reg, anc_buf, 6);
			anc_reg += 6;

			if (anc_reg >= bank_reg_base + GS2971_ANC_BANK_SIZE)
				break;

			if (!status) {
				if (anc_buf[0] == 0 ||
				    anc_buf[1] == 0xff || anc_buf[2] == 0xff) {
					did = anc_buf[3];
					sdid = anc_buf[4];
					anc_length = (anc_buf[5] & 0xff) + 1;
					anc_reg += anc_length;

					if (!(did == 0 && sdid == 0)
					    && (did < 0xf8)) {
						dev_dbg(&spi->dev,
							"anc[%x] %02x %02x %02x\n",
							anc_reg, did, sdid,
							anc_length);
					}
				} else {
					break;
				}
			}
		}
		dev_dbg(&spi->dev, "anc_end[%x] %02x %02x %02x\n",
			anc_reg, anc_buf[0], anc_buf[1], anc_buf[2]);
#endif

		/* Step 3: switch reads to other bank */
		gs2971_write_register(spi, GS2971_ANC_CONTROL,
				      ANCCTL_ANC_DATA_DEL);
	}
}

#if defined(GS2971_ENABLE_ANCILLARY_DATA)
static int gs2971_init_ancillary(struct spi_device *spi)
{
	pr_debug("-> In function %s\n", __func__);

	u16 value;
	int offset;

	int status = 0;

	/* Set up ancillary data filtering */
	if (!status)
		status =
		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE1, 0x4100);
	/*  SMPTE-352M Payload ID (0x4101) */
	if (!status)
		status = gs2971_write_register(spi, GS2971_REG_ANC_TYPE2, 0x5f00);	/* Placeholder */

	if (!status)
		status = gs2971_write_register(spi, GS2971_REG_ANC_TYPE3, 0x6000);	/* Placeholder */

	if (!status)
		status =
		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE4, 0x6100);
	/* SMPTE 334 - SDID 01=EIA-708, 02=EIA-608 */

	if (!status)
		status =
		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE5, 0x6200);
	/* SMPTE 334 - SDID 01=Program description, 02=Data broadcast, 03=VBI data */

	if (0 == gs2971_read_register(spi, GS2971_REG_ANC_TYPE1, &value)) {
		dev_dbg(&spi->dev, "REG_ANC_TYPE1 value x%04x\n",
			(unsigned int)value);
	}
	if (0 == gs2971_read_register(spi, GS2971_REG_ANC_TYPE2, &value)) {
		dev_dbg(&spi->dev, "REG_ANC_TYPE2 value x%04x\n",
			(unsigned int)value);
	}

	/* Clear old ancillary data */
	if (!status)
		status = gs2971_write_register(spi, GS2971_ANC_CONTROL,
					       ANCCTL_ANC_DATA_DEL |
					       ANCCTL_ANC_DATA_SWITCH);

	/* Step 2: start writing to other bank */
	if (!status)
		status =
		    gs2971_write_register(spi, GS2971_ANC_CONTROL,
					  ANCCTL_ANC_DATA_DEL);
	return status;
}
#endif

/* gs2971_initialize :
 * This function will set the video format standard
 */
static int gs2971_initialize(struct gs2971_priv *gs, struct spi_device *spi)
{
	int status = 0;
	int retry = 0;
	u16 value,i;
	static u16 anc_buf[257];

	static void __iomem *base;

	//base = ioremap(0x4A009800, SZ_4K);	cispl
	//__raw_writel(0x02,base);    		cispl

//	u16 cfg = GS_VCFG1_861_PIN_DISABLE_MASK;
	u16 cfg = 0xC0;
	if (gs->cea861)		
		cfg |= GS_VCFG1_TIMING_861_MASK;

	pr_debug("-> In function %s\n", __func__);
	for (;;) {
		status = gs2971_write_register(spi, GS2971_VCFG1, cfg);

		if (status)
			return status;
		status = gs2971_read_register(spi, GS2971_VCFG1, &value);

		if (status)
			return status;
		dev_err(&spi->dev, "status=%x, read value of 0x%08x, expected 0x%08x\n", status,
			(unsigned int)value, cfg);

		if (value == cfg)
			break;
		if (retry++ >= 20)
			return -ENODEV;
		msleep(50);
	}
	
//      status = gs2971_write_register(spi, GS2971_VCFG2, GS_VCFG2_DS_SWAP_3G);
	status = gs2971_write_register(spi, GS2971_VCFG2, 0);
	if (status)
		return status;

	status = gs2971_write_register(spi, GS2971_IO_CONFIG,
				       (GS_IOCFG_HSYNC << 0) | (GS_IOCFG_VSYNC
								<< 5) |
				       (GS_IOCFG_DE << 10));
	if (status)
		return status;

	status = gs2971_write_register(spi, GS2971_IO_CONFIG2,
				       (GS_IOCFG_LOCKED << 0) | (GS_IOCFG_Y_ANC
								 << 5) |
				       (GS_IOCFG_DATA_ERROR << 10));
	if (status)
		return status;

	status =
	    gs2971_write_register(spi, GS2971_TIM_861_CFG, GS_TIMCFG_TRS_861);		
	if (status)
		return status;
//	status =gs2971_write_register(spi, GS2971_RATE_SEL, 0x00);		//cispl
	for(i=0;i<38;i++)
	{
		gs2971_read_register(spi, i, &value);
		dev_err(&spi->dev, "register %02x = %08x\n",i,(unsigned int)value);
	}
#if defined(GS2971_ENABLE_ANCILLARY_DATA)
	gs2971_init_ancillary(spi);
#endif

#if 0
	if (gs2971_timer.function == NULL) {
		init_timer(&gs2971_timer);
		gs2971_timer.function = gs2971_timer_function;
	}
	mod_timer(&gs2971_timer, jiffies + msecs_to_jiffies(gs2971_timeout_ms));
#endif
	return status;
}

#if 0
/*!
 * Return attributes of current video standard.
 * Since this device autodetects the current standard, this function also
 * sets the values that need to be changed if the standard changes.
 * There is no set std equivalent function.
 *
 *  @return		None.
 */
static void gs2971_get_std(struct v4l2_int_device *s, v4l2_std_id * std)
{
	pr_debug("-> In function %s\n", __func__);
}
#endif

/***********************************************************************
 * IOCTL Functions from v4l2_int_ioctl_desc.
 ***********************************************************************/

/*!
 * ioctl_g_ifparm - V4L2 sensor interface handler for vidioc_int_g_ifparm_num
 * s: pointer to standard V4L2 device structure
 * p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure
 *
 * Gets slave interface parameters.
 * Calculates the required xclk value to support the requested
 * clock parameters in p.  This value is returned in the p
 * parameter.
 *
 * vidioc_int_g_ifparm returns platform-specific information about the
 * interface settings used by the sensor.
 *
 * Called on open.
 */
static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;

	pr_debug("-> In function %s\n", __func__);

	/* Initialize structure to 0s then set any non-0 values. */
	memset(p, 0, sizeof(*p));
	p->u.bt656.clock_curr = sensor->mclk;
	if (gs->cea861) {
		p->if_type = V4L2_IF_TYPE_BT656;	/* This is the only possibility. */
		p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT;
		p->u.bt656.bt_sync_correct = 1;
//      	p->u.bt656.nobt_vs_inv = 1;
		p->u.bt656.nobt_hs_inv = 1;
	} else {
		/*
		 * p->if_type = V4L2_IF_TYPE_BT656_PROGRESSIVE;
		 * BT.656 - 20/10bit pin low doesn't work because then EAV of
		 * DS1/2 are also interleaved and imx only recognizes 4 word
		 * EAV/SAV codes, not 8
		 */
		p->if_type = V4L2_IF_TYPE_BT1120_PROGRESSIVE_SDR;
		p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_BT_10BIT;
		p->u.bt656.bt_sync_correct = 0;	// Use embedded sync
		p->u.bt656.nobt_vs_inv = 1;
//		p->u.bt656.nobt_hs_inv = 1;
	}
	p->u.bt656.latch_clk_inv = 0;	/* pixel clk polarity */
	p->u.bt656.clock_min = 6000000;
	p->u.bt656.clock_max = 180000000;
	return 0;
}

static int ioctl_s_power(struct v4l2_int_device *s, int on)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;

	pr_debug("-> In function %s\n", __func__);

	if (on && !sensor->on) {
		power_control(gs, 1);
	} else if (!on && sensor->on) {
		power_control(gs, 0);
	}
	return 0;
}

/*!
 * ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl
 * @s: pointer to standard V4L2 device structure
 * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure
 *
 * Returns the sensor's video CAPTURE parameters.
 */
static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;
	struct v4l2_captureparm *cparm = &a->parm.capture;

	pr_debug("-> In function %s\n", __func__);

	switch (a->type) {
		/* These are all the possible cases. */
	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
		pr_debug("   type is V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
		memset(a, 0, sizeof(*a));
		a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
		cparm->capability = sensor->streamcap.capability;
		cparm->timeperframe = sensor->streamcap.timeperframe;
		cparm->capturemode = sensor->streamcap.capturemode;
		break;

	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
	case V4L2_BUF_TYPE_VBI_CAPTURE:
	case V4L2_BUF_TYPE_VBI_OUTPUT:
	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
		break;

	default:
		pr_debug("ioctl_g_parm:type is unknown %d\n", a->type);
		break;
	}
	return 0;
}

/*!
 * ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl
 * @s: pointer to standard V4L2 device structure
 * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure
 *
 * Configures the sensor to use the input parameters, if possible.  If
 * not possible, reverts to the old parameters and returns the
 * appropriate error code.
 *
 * This driver cannot change these settings.
 */
static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;
	struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
	int ret = 0;

	pr_debug("-> In function %s\n", __func__);

	/* Make sure power on */
	power_control(gs, 1);

	switch (a->type) {
		/* This is the only case currently handled. */
	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
		/* Check that the new frame rate is allowed. */
		if ((timeperframe->numerator == 0) ||
		    (timeperframe->denominator == 0)) {
			timeperframe->denominator =
			    gs2971_framerates[gs2971_default_fps];
			timeperframe->numerator = 1;
			pr_warning("   Setting framerate to default (%dfps)!\n",
				   gs2971_framerates[gs2971_default_fps]);
		} else if (timeperframe->denominator !=
			   gs2971_framerates[gs->framerate]) {
			pr_warning
			    ("   Input framerate is %dfps and you are trying to set %dfps!\n",
			     gs2971_framerates[gs->framerate],
			     timeperframe->denominator);
		}
		sensor->streamcap.timeperframe = *timeperframe;
		sensor->streamcap.capturemode =
		    (u32) a->parm.capture.capturemode;
		break;

		/* These are all the possible cases. */
	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
	case V4L2_BUF_TYPE_VBI_CAPTURE:
	case V4L2_BUF_TYPE_VBI_OUTPUT:
	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
		pr_debug("   type is not V4L2_BUF_TYPE_VIDEO_CAPTURE but %d\n",
			 a->type);
		ret = -EINVAL;
		break;

	default:
		pr_debug("   type is unknown - %d\n", a->type);
		ret = -EINVAL;
		break;
	}
	return ret;
}

/*!
 * ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap
 * @s: pointer to standard V4L2 device structure
 * @f: pointer to standard V4L2 v4l2_format structure
 *
 * Returns the sensor's current pixel format in the v4l2_format
 * parameter.
 */
static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;
	v4l2_std_id std = V4L2_STD_UNKNOWN;

	pr_debug("-> In function %s\n", __func__);

	power_control(gs, 1);
	switch (f->type) {
	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
		get_std(s, &std);
		f->fmt.pix = sensor->pix;
		break;

	case V4L2_BUF_TYPE_SENSOR:
		pr_debug("%s: left=%d, top=%d, %dx%d\n", __func__,
			sensor->spix.left, sensor->spix.top,
			sensor->spix.swidth, sensor->spix.sheight);
		f->fmt.spix = sensor->spix;
		break;

	case V4L2_BUF_TYPE_PRIVATE:
		get_std(s, &std);
//              f->fmt.pix.pixelformat = (u32)std;
		break;

	default:
		f->fmt.pix = sensor->pix;
		break;
	}
	return 0;
}

/*!
 * ioctl_queryctrl - V4L2 sensor interface handler for VIDIOC_QUERYCTRL ioctl
 * @s: pointer to standard V4L2 device structure
 * @qc: standard V4L2 VIDIOC_QUERYCTRL ioctl structure
 *
 * If the requested control is supported, returns the control information
 * from the video_control[] array.  Otherwise, returns -EINVAL if the
 * control is not supported.
 */
static int ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qc)
{
	pr_debug("-> In function %s\n", __func__);
	return -EINVAL;
}

/*!
 * ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl
 * @s: pointer to standard V4L2 device structure
 * @vc: standard V4L2 VIDIOC_G_CTRL ioctl structure
 *
 * If the requested control is supported, returns the control's current
 * value from the video_control[] array.  Otherwise, returns -EINVAL
 * if the control is not supported.
 */
static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;
	int ret = 0;

	pr_debug("-> In function %s\n", __func__);

	switch (vc->id) {
	case V4L2_CID_BRIGHTNESS:
		vc->value = sensor->brightness;
		break;
	case V4L2_CID_HUE:
		vc->value = sensor->hue;
		break;
	case V4L2_CID_CONTRAST:
		vc->value = sensor->contrast;
		break;
	case V4L2_CID_SATURATION:
		vc->value = sensor->saturation;
		break;
	case V4L2_CID_RED_BALANCE:
		vc->value = sensor->red;
		break;
	case V4L2_CID_BLUE_BALANCE:
		vc->value = sensor->blue;
		break;
	case V4L2_CID_EXPOSURE:
		vc->value = sensor->ae_mode;
		break;
	default:
		ret = -EINVAL;
	}
	return ret;
}

/*!
 * ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl
 * @s: pointer to standard V4L2 device structure
 * @vc: standard V4L2 VIDIOC_S_CTRL ioctl structure
 *
 * If the requested control is supported, sets the control's current
 * value in HW (and updates the video_control[] array).  Otherwise,
 * returns -EINVAL if the control is not supported.
 */
static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
{
	struct gs2971_priv *gs = s->priv;
//	struct sensor_data *sensor = &gs->sensor;
	int retval = 0;

	pr_debug("-> In function %s\n", __func__);

	///* Make sure power on */
	power_control(gs, 1);

	switch (vc->id) {
	case V4L2_CID_BRIGHTNESS:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_BRIGHTNESS\n");
		break;
	case V4L2_CID_CONTRAST:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_CONTRAST\n");
		break;
	case V4L2_CID_SATURATION:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_SATURATION\n");
		break;
	case V4L2_CID_HUE:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_HUE\n");
		break;
	case V4L2_CID_AUTO_WHITE_BALANCE:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_AUTO_WHITE_BALANCE\n");
		break;
	case V4L2_CID_DO_WHITE_BALANCE:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_DO_WHITE_BALANCE\n");
		break;
	case V4L2_CID_RED_BALANCE:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_RED_BALANCE\n");
		break;
	case V4L2_CID_BLUE_BALANCE:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_BLUE_BALANCE\n");
		break;
	case V4L2_CID_GAMMA:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_GAMMA\n");
		break;
	case V4L2_CID_EXPOSURE:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_EXPOSURE\n");
		break;
	case V4L2_CID_AUTOGAIN:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_AUTOGAIN\n");
		break;
	case V4L2_CID_GAIN:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_GAIN\n");
		break;
	case V4L2_CID_HFLIP:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_HFLIP\n");
		break;
	case V4L2_CID_VFLIP:
		dev_dbg(&spidata->spi->dev, "   V4L2_CID_VFLIP\n");
		break;
	default:
		dev_dbg(&spidata->spi->dev, "   Default case\n");
		retval = -EPERM;
		break;
	}
	return retval;
}

/*!
 * ioctl_enum_framesizes - V4L2 sensor interface handler for
 *			   VIDIOC_ENUM_FRAMESIZES ioctl
 * @s: pointer to standard V4L2 device structure
 * @fsize: standard V4L2 VIDIOC_ENUM_FRAMESIZES ioctl structure
 *
 * Return 0 if successful, otherwise -EINVAL.
 */
static int ioctl_enum_framesizes(struct v4l2_int_device *s,
				 struct v4l2_frmsizeenum *fsize)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;

	pr_debug("-> In function %s\n", __func__);

	if (fsize->index > gs2971_mode_MAX || gs->mode > gs2971_mode_MAX)
		return -EINVAL;

	fsize->pixel_format = sensor->pix.pixelformat;
	fsize->discrete.width = gs2971_res[gs->mode].width;
	fsize->discrete.height = gs2971_res[gs->mode].height;
	return 0;
}

/*!
 * ioctl_g_chip_ident - V4L2 sensor interface handler for
 *			VIDIOC_DBG_G_CHIP_IDENT ioctl
 * @s: pointer to standard V4L2 device structure
 * @id: pointer to int
 *
 * Return 0.
 */
static int ioctl_g_chip_ident(struct v4l2_int_device *s, int *id)
{
	pr_debug("-> In function %s\n", __func__);

	((struct v4l2_dbg_chip_ident *)id)->match.type =
	    V4L2_CHIP_MATCH_I2C_DRIVER;
	strcpy(((struct v4l2_dbg_chip_ident *)id)->match.name, "gs2971_video");

	return 0;
}

/*!
 * ioctl_enum_fmt_cap - V4L2 sensor interface handler for VIDIOC_ENUM_FMT
 * @s: pointer to standard V4L2 device structure
 * @fmt: pointer to standard V4L2 fmt description structure
 *
 * Return 0.
 */
static int ioctl_enum_fmt_cap(struct v4l2_int_device *s,
			      struct v4l2_fmtdesc *fmt)
{
	struct gs2971_priv *gs = s->priv;
	struct sensor_data *sensor = &gs->sensor;

	pr_debug("-> In function %s\n", __func__);

	if (fmt->index > 0)
		return -EINVAL;
	fmt->pixelformat = sensor->pix.pixelformat;	//gs->pix.pixelformat;
	return 0;
}

/*!
 * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT
 * @s: pointer to standard V4L2 device structure
 */
static int ioctl_init(struct v4l2_int_device *s)
{
	pr_debug("-> In function %s\n", __func__);
	return 0;
}

/*!
 * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num
 * @s: pointer to standard V4L2 device structure
 *
 * Initialise the device when slave attaches to the master.
 */
static int ioctl_dev_init(struct v4l2_int_device *s)
{
	pr_debug("-> In function %s\n", __func__);
	return 0;
}

/*!
 * This structure defines all the ioctls for this module.
 */
static struct v4l2_int_ioctl_desc gs2971_ioctl_desc[] = {

	{vidioc_int_dev_init_num, (v4l2_int_ioctl_func *) ioctl_dev_init},
	{vidioc_int_s_power_num, (v4l2_int_ioctl_func *) ioctl_s_power},
	{vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func *) ioctl_g_ifparm},
	{vidioc_int_init_num, (v4l2_int_ioctl_func *) ioctl_init},

	/*!
	 * VIDIOC_ENUM_FMT ioctl for the CAPTURE buffer type.
	 */
	{vidioc_int_enum_fmt_cap_num,
	 (v4l2_int_ioctl_func *) ioctl_enum_fmt_cap},
	{vidioc_int_g_fmt_cap_num, (v4l2_int_ioctl_func *) ioctl_g_fmt_cap},
	{vidioc_int_g_parm_num, (v4l2_int_ioctl_func *) ioctl_g_parm},
	{vidioc_int_s_parm_num, (v4l2_int_ioctl_func *) ioctl_s_parm},
	{vidioc_int_queryctrl_num, (v4l2_int_ioctl_func *) ioctl_queryctrl},
	{vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func *) ioctl_g_ctrl},
	{vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl},
	{vidioc_int_enum_framesizes_num,
	 (v4l2_int_ioctl_func *) ioctl_enum_framesizes},
	{vidioc_int_g_chip_ident_num,
	 (v4l2_int_ioctl_func *) ioctl_g_chip_ident},
};

static struct v4l2_int_slave gs2971_slave = {
	.ioctls = gs2971_ioctl_desc,
	.num_ioctls = ARRAY_SIZE(gs2971_ioctl_desc),
};

static struct v4l2_int_device gs2971_int_device = {
	.module = THIS_MODULE,
	.name = "gs2971",
	.type = v4l2_int_type_slave,
	.u = {
	      .slave = &gs2971_slave,
	      },
};

/*!
 * GS2971 SPI probe function.
 * Function set in spi_driver struct.
 * Called by insmod.
 *
 *  @param *spi	SPI device descriptor.
 *
 *  @return		Error code indicating success or failure.
 */
static int gs2971_probe(struct spi_device *spi)
{
	struct v4l2_subdev *sd;
	struct v4l2_subdev_ops *ops;
	struct device *dev = &spi->dev;
	struct gs2971_priv *gs;
	struct sensor_data *sensor;
	struct pinctrl_state *pins;

	int ret = 0;

	pr_debug("-> In function %s\n", __func__);

	gs = kzalloc(sizeof(*gs), GFP_KERNEL);
	if (!gs)
			return -ENOMEM;

	/* Allocate driver data */
	spidata = kzalloc(sizeof(*spidata), GFP_KERNEL);
	if (!spidata) {
		ret = -ENOMEM;
		goto exit;
	}
	/* Initialize the driver data */
	spidata->spi = spi;
	mutex_init(&spidata->buf_lock);
	sensor = &gs->sensor;

	/* Set initial values for the sensor struct. */
	memset(gs, 0, sizeof(*gs));
	ret = of_property_read_u32(dev->of_node, "mclk", &sensor->mclk);
	dev_err(dev, "mclk=%x\n",sensor->mclk);
	if (ret) {
		dev_err(dev, "mclk missing or invalid\n");
		goto exit;
	}

	ret = of_property_read_u32(dev->of_node, "ipu", &sensor->ipu_id);
	dev_err(dev, "ipu=%x\n",sensor->ipu_id);
	if (ret) {
		dev_err(dev, "ipu missing or invalid\n");
		//goto exit;
	}

	ret = of_property_read_u32(dev->of_node, "csi", &sensor->csi);
	if (ret) {
		dev_err(dev, "csi missing or invalid\n");
		goto exit;
	}

	ret = of_property_read_u32(dev->of_node, "cea861", &gs->cea861);
	if (ret) {
		dev_err(dev, "cea861 missing or invalid\n");
		goto exit;
	}
	pr_info("%s:cea861=%d\n", __func__, gs->cea861);

	/*gs->pinctrl = devm_pinctrl_get(dev);
	if (IS_ERR(gs->pinctrl)) {
		ret = PTR_ERR(gs->pinctrl);
		dev_err(dev, "pinctrl missing or invalid\n");
		goto exit;
	}


	pins = pinctrl_lookup_state(gs->pinctrl, gs->cea861 ? "cea861" : "no_cea861");
	if (IS_ERR(pins)) {
		ret = PTR_ERR(pins);
		dev_err(dev, "pinctrl lookup state missing or invalid\n");
		goto exit;
	}

	ret = pinctrl_select_state(gs->pinctrl, pins);
	if (ret)
	{
		dev_err(dev, "pinctrl select state missing or invalid\n");
		goto exit;
	}*/
	sensor->pix.pixelformat = YUV_FORMAT(gs);
	sensor->pix.width = gs2971_res[gs2971_mode_default].width;
	sensor->pix.height = gs2971_res[gs2971_mode_default].height;
	sensor->streamcap.capability = V4L2_MODE_HIGHQUALITY |
	    V4L2_CAP_TIMEPERFRAME;
	sensor->streamcap.capturemode = 0;
	sensor->streamcap.timeperframe.denominator = DEFAULT_FPS;
	sensor->streamcap.timeperframe.numerator = 1;

	//sensor->pix.priv = 1;  /* 1 is used to indicate TV in */
	/*ret = gs2971_get_gpios(gs, dev);
	if (ret)
	{
		dev_err(dev, "get gpio missing or invalid\n");	
		goto exit;
	}*/
	power_control(gs, 1);
	gs2971_int_device.priv = gs;

	ret = gs2971_initialize(gs, spi);
	if (ret)
	{	
		dev_err(dev, "gs2971 init missing or invalid\n");	
		goto exit;
	}
	power_control(gs, 0);

	ret = v4l2_int_device_register(&gs2971_int_device);
	v4l2_subdev_init(sd, ops);
	ret = v4l2_async_register_subdev(sd);
		
 exit:
	if (ret) {
		kfree(spidata);
		kfree(gs);
		pr_err("gs2971_probe returns %d\n", ret);
	}
	return ret;

}

static int gs2971_remove(struct spi_device *spi)
{
	struct v4l2_subdev *sd;
	pr_debug("-> In function %s\n", __func__);
	kfree(gs2971_int_device.priv);
	kfree(spidata);
	v4l2_int_device_unregister(&gs2971_int_device);
	v4l2_async_unregister_subdev(sd);
	return 0;
}

static const struct of_device_id gs2971_dt_ids[] = {
	{
		.compatible = "gn,gs2971",
	}, {
		/* sentinel */
	}
};
MODULE_DEVICE_TABLE(of, gs2971_dt_ids);

static struct spi_driver gs2971_spi = {
	.driver = {
		   .name = DRIVER_NAME,
		   .bus = &spi_bus_type,
		   .owner = THIS_MODULE,
		   .of_match_table = gs2971_dt_ids,
		   },
	.probe = gs2971_probe,
	.remove = gs2971_remove,
};

/*!
 * gs2971 init function.
 * Called on insmod.
 *
 * @return    Error code indicating success or failure.
 */
static int __init gs2971_init(void)
{
	int ret;

	pr_debug("-> In function %s\n", __func__);

	ret = spi_register_driver(&gs2971_spi);

	return ret;
}

/*!
 * gs2971 cleanup function.
 * Called on rmmod.
 *
 * @return   Error code indicating success or failure.
 */
static void __exit gs2971_exit(void)
{
	pr_debug("-> In function %s\n", __func__);

	spi_unregister_driver(&gs2971_spi);
}

module_init(gs2971_init);
module_exit(gs2971_exit);
MODULE_DESCRIPTION("gs2971 video input Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION("1.0");
MODULE_ALIAS("CSI");

U-Boot 2019.01 (Nov 16 2021 - 15:24:57 +0530)

CPU  : DRA752-GP ES2.0
Model: TI AM5728 BeagleBoard-X15
Board: CARAVEL-DECODER AM572x EVM REV
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Loading Environment from MMC... MMC Device 1 not found
*** Warning - No MMC card found, using default environment

Warning: fastboot.board_rev: unknown board revision
invalid mmc device
Net:
Warning: ethernet@48484000 using MAC address from ROM
eth0: ethernet@48484000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Unable to read file boot.scr **
1490 bytes read in 1 ms (1.4 MiB/s)
Loaded env from uEnv.txt
Importing environment from mmc0 ...
Running uenvcmd ...
1 bytes read in 3 ms (0 Bytes/s)
Already setup.
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
4440576 bytes read in 197 ms (21.5 MiB/s)
135414 bytes read in 8 ms (16.1 MiB/s)
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffdb000, end 8ffff0f5 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.59-g5f8c1c6121 (root@ubuntu-OptiPlex-3040) (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #32 SMP PREEMPT Tue Nov 16 17:22:10 IST 2021
[    0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=30c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: TI AM5728 EVM
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000095800000, size 56 MiB
[    0.000000] OF: reserved mem: initialized node ipu2-memory@95800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000099000000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node dsp1-memory@99000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009d000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node ipu1-memory@9d000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009f000000, size 8 MiB
[    0.000000] OF: reserved mem: initialized node dsp2-memory@9f000000, compatible id shared-dma-pool
[    0.000000] cma: Reserved 24 MiB at 0x00000000be400000
[    0.000000] OMAP4: Map 0x00000000bfd00000 to (ptrval) for dram barrier
[    0.000000] DRA752 ES2.0
[    0.000000] random: get_random_bytes called from start_kernel+0xc0/0x47c with crng_init=0
[    0.000000] percpu: Embedded 16 pages/cpu s36492 r8192 d20852 u65536
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 259648
[    0.000000] Kernel command line: console=ttyS2,115200n8 root=PARTUUID=3d843c32-02 rw rootfstype=ext4 rootwait
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 829144K/1045504K available (10240K kernel code, 336K rwdata, 2792K rodata, 2048K init, 276K bss, 27944K reserved, 188416K cma-reserved, 234496K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (12256 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (2048 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 337 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 277 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] OMAP clockevent source: timer1 at 32786 Hz
[    0.000000] arch_timer: cp15 timer(s) running at 6.14MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x16af5adb9, max_idle_ns: 440795202250 ns
[    0.000005] sched_clock: 56 bits at 6MHz, resolution 162ns, wraps every 4398046511023ns
[    0.000018] Switching to timer-based delay loop, resolution 162ns
[    0.000922] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
[    0.000932] OMAP clocksource: 32k_counter at 32768 Hz
[    0.002457] Console: colour dummy device 80x30
[    0.002502] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.29 BogoMIPS (lpj=61475)
[    0.002521] pid_max: default: 32768 minimum: 301
[    0.002644] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002661] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.003247] CPU: Testing write buffer coherency: ok
[    0.003288] CPU0: Spectre v2: using ICIALLU workaround
[    0.003515] /cpus/cpu@0 missing clock-frequency property
[    0.003536] /cpus/cpu@1 missing clock-frequency property
[    0.003550] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.059895] Setting up static identity map for 0x80200000 - 0x80200060
[    0.079902] rcu: Hierarchical SRCU implementation.
[    0.100092] EFI services will not be available.
[    0.119963] smp: Bringing up secondary CPUs ...
[    0.200298] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.200304] CPU1: Spectre v2: using ICIALLU workaround
[    0.200427] smp: Brought up 1 node, 2 CPUs
[    0.200439] SMP: Total of 2 processors activated (24.59 BogoMIPS).
[    0.200448] CPU: All CPU(s) started in HYP mode.
[    0.200456] CPU: Virtualization extensions available.
[    0.200961] devtmpfs: initialized
[    0.221881] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
[    0.222149] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.222169] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.225410] pinctrl core: initialized pinctrl subsystem
[    0.225942] DMI not present or invalid.
[    0.226234] NET: Registered protocol family 16
[    0.227398] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.228353] omap_hwmod: l3_main_2 using broken dt data from ocp
[    0.420538] cpuidle: using governor ladder
[    0.420574] cpuidle: using governor menu
[    0.431235] OMAP GPIO hardware version 0.1
[    0.455907] No ATAGs?
[    0.455982] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.455998] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.456564] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.456577] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    0.457221] OMAP DMA hardware revision 0.0
[    0.468952] edma 43300000.edma: memcpy is disabled
[    0.472490] edma 43300000.edma: TI EDMA DMA engine driver
[    0.479696] omap-dma-engine 4a056000.dma-controller: OMAP DMA engine driver (LinkedList1/2/3 supported)
[    0.481070] evm_5v0: supplied by main_12v0
[    0.481458] com_3v6: supplied by evm_5v0
[    0.484514] omap-iommu 40d01000.mmu: 40d01000.mmu registered
[    0.484697] omap-iommu 40d02000.mmu: 40d02000.mmu registered
[    0.484948] omap-iommu 58882000.mmu: 58882000.mmu registered
[    0.485184] omap-iommu 55082000.mmu: 55082000.mmu registered
[    0.485555] omap-iommu 41501000.mmu: 41501000.mmu registered
[    0.485726] omap-iommu 41502000.mmu: 41502000.mmu registered
[    0.486002] iommu: Adding device 58820000.ipu to group 1
[    0.486089] iommu: Adding device 55020000.ipu to group 2
[    0.486226] iommu: Adding device 40800000.dsp to group 0
[    0.486472] iommu: Adding device 41000000.dsp to group 3
[    0.487694] SCSI subsystem initialized
[    0.488765] palmas 0-0058: Irq flag is 0x00000008
[    0.512795] palmas 0-0058: Muxing GPIO 2f, PWM 0, LED 0
[    0.514399] SMPS12: supplied by regulator-dummy
[    0.516072] SMPS3: supplied by regulator-dummy
[    0.517743] SMPS45: supplied by regulator-dummy
[    0.519556] SMPS6: supplied by regulator-dummy
[    0.520971] SMPS7: supplied by regulator-dummy
[    0.522362] SMPS8: supplied by regulator-dummy
[    0.523617] SMPS9: supplied by regulator-dummy
[    0.524309] LDO1: supplied by regulator-dummy
[    0.531045] random: fast init done
[    0.531314] LDO2: supplied by regulator-dummy
[    0.541173] LDO3: supplied by regulator-dummy
[    0.551174] LDO4: supplied by regulator-dummy
[    0.561199] LDO5: supplied by regulator-dummy
[    0.561895] LDO6: supplied by regulator-dummy
[    0.562589] LDO7: supplied by regulator-dummy
[    0.563279] LDO8: supplied by regulator-dummy
[    0.563969] LDO9: supplied by regulator-dummy
[    0.571234] LDOLN: supplied by regulator-dummy
[    0.581252] LDOUSB: supplied by regulator-dummy
[    0.593297] omap_i2c 48070000.i2c: bus 0 rev0.12 at 400 kHz
[    0.593872] omap_i2c 4807c000.i2c: bus 4 rev0.12 at 400 kHz
[    0.594090] media: Linux media interface: v0.10
[    0.594130] videodev: Linux video capture interface: v2.00
[    0.594206] pps_core: LinuxPPS API ver. 1 registered
[    0.594215] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.594236] PTP clock support registered
[    0.594271] EDAC MC: Ver: 3.0.0
[    0.595285] Advanced Linux Sound Architecture Driver Initialized.
[    0.596056] clocksource: Switched to clocksource arch_sys_counter
[    0.604247] NET: Registered protocol family 2
[    0.604827] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[    0.604856] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.604920] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.605047] TCP: Hash tables configured (established 8192 bind 8192)
[    0.605123] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.605159] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.605290] NET: Registered protocol family 1
[    0.625732] RPC: Registered named UNIX socket transport module.
[    0.625744] RPC: Registered udp transport module.
[    0.625753] RPC: Registered tcp transport module.
[    0.625762] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.626844] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[    0.627065] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.628037] Initialise system trusted keyrings
[    0.628169] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.632998] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.643491] NFS: Registering the id_resolver key type
[    0.643513] Key type id_resolver registered
[    0.643522] Key type id_legacy registered
[    0.643564] ntfs: driver 2.1.32 [Flags: R/O].
[    0.645172] Key type asymmetric registered
[    0.645184] Asymmetric key parser 'x509' registered
[    0.645233] bounce: pool size: 64 pages
[    0.645267] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.645278] io scheduler noop registered
[    0.645288] io scheduler deadline registered
[    0.645390] io scheduler cfq registered (default)
[    0.645401] io scheduler mq-deadline registered
[    0.645411] io scheduler kyber registered
[    0.651317] pinctrl-single 4a003400.pinmux: 282 pins, size 1128
[    0.655479] dra7-pcie 51000000.pcie: Linked as a consumer to phy-4a094000.pciephy.1
[    0.655741] dra7-pcie 51000000.pcie: WA for Errata i870 not applied
[    0.655836] dra7-pcie 51000000.pcie: host bridge /ocp/axi@0/pcie@51000000 ranges:
[    0.655878] dra7-pcie 51000000.pcie:    IO 0x20003000..0x20012fff -> 0x00000000
[    0.655905] dra7-pcie 51000000.pcie:   MEM 0x20013000..0x2fffffff -> 0x20013000
[    1.656195] dra7-pcie 51000000.pcie: Phy link never came up
[    1.656327] dra7-pcie 51000000.pcie: PCI host bridge to bus 0000:00
[    1.656342] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.656355] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    1.656366] pci_bus 0000:00: root bus resource [mem 0x20013000-0x2fffffff]
[    1.663077] PCI: bus0: Fast back to back transfers disabled
[    1.669428] PCI: bus1: Fast back to back transfers enabled
[    1.669473] pci 0000:00:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff 64bit]
[    1.669493] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    1.669823] pcieport 0000:00:00.0: Signaling PME with IRQ 166
[    1.669960] pcieport 0000:00:00.0: AER enabled with IRQ 166
[    1.671069] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[    1.671144] pwm-backlight backlight: Linked as a consumer to regulator.0
[    1.674275] vdd_3v3: supplied by regen1
[    1.674509] aic_dvdd_fixed: supplied by vdd_3v3
[    1.674575] vtt_fixed: supplied by smps3
[    1.719057] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
[    1.722625] console [ttyS2] disabled
[    1.722682] 48020000.serial: ttyS2 at MMIO 0x48020000 (irq = 45, base_baud = 3000000) is a 8250
[    2.828322] console [ttyS2] enabled
[    2.832726] 48422000.serial: ttyS7 at MMIO 0x48422000 (irq = 46, base_baud = 3000000) is a 8250
[    2.843917] omap_rng 48090000.rng: Random Number Generator ver. 20
[    2.844242] random: crng init done
[    2.851070] omapdss_dss 58000000.dss: 58000000.dss supply vdda_video not found, using dummy regulator
[    2.862941] omapdss_dss 58000000.dss: Linked as a consumer to regulator.0
[    2.869987] omapdss_dss 58000000.dss: Dropping the link to regulator.0
[    2.882031] panel-simple display: display supply power not found, using dummy regulator
[    2.890142] panel-simple display: Linked as a consumer to regulator.0
[    2.904875] brd: module loaded
[    2.914404] loop: module loaded
[    2.922212] libphy: Fixed MDIO Bus: probed
[    2.986081] davinci_mdio 48485000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.993775] libphy: 48485000.mdio: probed
[    3.001518] mdio_bus 48485000.mdio: MDIO device at address 2 is missing.
[    3.008275] davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[    3.018527] cpsw 48484000.ethernet: Detected MACID = 88:3f:4a:bc:56:06
[    3.025123] cpsw 48484000.ethernet: initialized cpsw ale version 1.4
[    3.031524] cpsw 48484000.ethernet: ALE Table size 1024
[    3.036835] cpsw 48484000.ethernet: cpts: overflow check period 500 (jiffies)
[    3.044823] cpsw 48484000.ethernet: cpsw: Detected MACID = 88:3f:4a:bc:56:07
[    3.053111] i2c /dev entries driver
[    3.057532] gs2971 spi3.2: mclk=19bfcc0
[    3.061389] gs2971 spi3.2: ipu=0
[    3.064631] gs2971 spi3.2: ipu missing or invalid
[    3.069375] gs2971_probe:cea861=0
[    3.072709] gs2971_gpio_state: active=0, standby-gpios(0)=0x0
[    4.156267] gs2971 spi3.2: status=0, read value of 0x000000c0, expected 0x000000c0
[    4.164263] gs2971 spi3.2: register 00 = 000000c0
[    4.169075] gs2971 spi3.2: register 01 = 00000000
[    4.173867] gs2971 spi3.2: register 02 = 00000000
[    4.178680] gs2971 spi3.2: register 03 = 00000000
[    4.183473] gs2971 spi3.2: register 04 = 00000000
[    4.188284] gs2971 spi3.2: register 05 = 00004210
[    4.193077] gs2971 spi3.2: register 06 = 00001dff
[    4.197888] gs2971 spi3.2: register 07 = 00001dff
[    4.202681] gs2971 spi3.2: register 08 = 00000820
[    4.207505] gs2971 spi3.2: register 09 = 00001883
[    4.212298] gs2971 spi3.2: register 0a = 00000000
[    4.217109] gs2971 spi3.2: register 0b = 00000000
[    4.221903] gs2971 spi3.2: register 0c = 00000000
[    4.226713] gs2971 spi3.2: register 0d = 00000000
[    4.231504] gs2971 spi3.2: register 0e = 00000000
[    4.236316] gs2971 spi3.2: register 0f = 00000000
[    4.241121] gs2971 spi3.2: register 10 = 00000000
[    4.245911] gs2971 spi3.2: register 11 = 00000000
[    4.250722] gs2971 spi3.2: register 12 = 00000000
[    4.255515] gs2971 spi3.2: register 13 = 00000000
[    4.260325] gs2971 spi3.2: register 14 = 00000000
[    4.265118] gs2971 spi3.2: register 15 = 00000000
[    4.269927] gs2971 spi3.2: register 16 = 00000000
[    4.274732] gs2971 spi3.2: register 17 = 00000000
[    4.279555] gs2971 spi3.2: register 18 = 00000000
[    4.284346] gs2971 spi3.2: register 19 = 00000000
[    4.289159] gs2971 spi3.2: register 1a = 00000000
[    4.293952] gs2971 spi3.2: register 1b = 00000000
[    4.298763] gs2971 spi3.2: register 1c = 00000000
[    4.303554] gs2971 spi3.2: register 1d = 00000000
[    4.308364] gs2971 spi3.2: register 1e = 00000000
[    4.313155] gs2971 spi3.2: register 1f = 00000000
[    4.317965] gs2971 spi3.2: register 20 = 00000000
[    4.322758] gs2971 spi3.2: register 21 = 00000000
[    4.327581] gs2971 spi3.2: register 22 = 00000000
[    4.332373] gs2971 spi3.2: register 23 = 00000000
[    4.337181] gs2971 spi3.2: register 24 = 00000004
[    4.341973] gs2971 spi3.2: register 25 = 00000040
[    4.346717] gs2971_gpio_state: active=1, standby-gpios(0)=0x1
[    4.352501] Unable to handle kernel NULL pointer dereference at virtual address 000000a8
[    4.360643] pgd = ed0fa042
[    4.363361] [000000a8] *pgd=80000080004003, *pmd=00000000
[    4.368810] Internal error: Oops: 206 [#1] PREEMPT SMP ARM
[    4.374317] Modules linked in:
[    4.377391] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.19.59-g5f8c1c6121 #32
[    4.384556] Hardware name: Generic DRA74X (Flattened Device Tree)
[    4.390685] PC is at v4l2_async_register_subdev+0xc/0x1c8
[    4.396111] LR is at gs2971_probe+0x3f0/0x418
[    4.400485] pc : [<c07d3f34>]    lr : [<c07e569c>]    psr: 60000013
[    4.406779] sp : ef08fd28  ip : ef08fd50  fp : ef08fd4c
[    4.412025] r10: c0e4491c  r9 : c0e44950  r8 : 00000026
[    4.417271] r7 : c1204c48  r6 : c1290d1c  r5 : ee4cd000  r4 : ee456400
[    4.423826] r3 : ef098000  r2 : 00000000  r1 : 00000000  r0 : 00000000
[    4.430382] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
[    4.437547] Control: 30c5387d  Table: 80003000  DAC: fffffffd
[    4.443318] Process swapper/0 (pid: 1, stack limit = 0xcb1acf53)
[    4.449351] Stack: (0xef08fd28 to 0xef090000)
[    4.453728] fd20:                   ee456400 ee4cd000 c1290d1c c1204c48 00000026 c0e44950
[    4.461943] fd40: ef08fd8c ef08fd50 c07e569c c07d3f34 000000c0 c03c6850 00010040 fc08bb2e
[    4.470158] fd60: 00000000 ee456400 00000000 c124296c 00000000 00000000 c124297c 00000000
[    4.478372] fd80: ef08fdac ef08fd90 c074b6ec c07e52b8 c128f2b0 ee456400 c128f2b4 00000000
[    4.486585] fda0: ef08fddc ef08fdb0 c06b2f90 c074b674 00000000 ee456400 c124297c ee456434
[    4.494799] fdc0: c06b3308 00000000 c104c834 c10626e0 ef08fe14 ef08fde0 c06b31f0 c06b2d98
[    4.503013] fde0: c084d890 c084b6b0 ef08fe14 ef08fdf8 ee456400 c124297c ee456434 c06b3308
[    4.511227] fe00: 00000000 c104c834 ef08fe34 ef08fe18 c06b33ec c06b3194 eeb3fbb4 c1204c48
[    4.519441] fe20: c124297c c06b3308 ef08fe64 ef08fe38 c06b1080 c06b3314 ef08fe70 ef209958
[    4.527654] fe40: eeb3fbb4 fc08bb2e c124297c c123c358 ee4cb100 00000000 ef08fe74 ef08fe68
[    4.535868] fe60: c06b28c8 c06b1010 ef08fe9c ef08fe78 c06b2364 c06b28b0 c0e449a4 ef08fe88
[    4.544080] fe80: c124297c c1204c48 ffffe000 c102e05c ef08feb4 ef08fea0 c06b3dd0 c06b21ac
[    4.552294] fea0: c1254100 c1204c48 ef08fec4 ef08feb8 c074b628 c06b3d60 ef08fed4 ef08fec8
[    4.560508] fec0: c102e074 c074b5d4 ef08ff4c ef08fed8 c02025b8 c102e068 00000000 c0dd2c7c
[    4.568722] fee0: c0dd2c5c c0dd2c00 c0ddeafc c1204c48 00000000 c0dd2c34 00000006 00000006
[    4.576935] ff00: 00000000 c0e37e9c c10004f0 c0eb8b44 ef08ff34 ef658044 00000000 fc08bb2e
[    4.585150] ff20: 00000000 fc08bb2e c1254100 00000007 c1254100 c1254100 c10004f0 c104c854
[    4.593362] ff40: ef08ff94 ef08ff50 c1000ff4 c0202540 00000006 00000006 00000000 c10004f0
[    4.601576] ff60: c0eb8b44 000000e7 ffffe000 00000000 c0a1c518 00000000 00000000 00000000
[    4.609789] ff80: 00000000 00000000 ef08ffac ef08ff98 c0a1c528 c1000e3c 00000000 c0a1c518
[    4.618002] ffa0: 00000000 ef08ffb0 c02010d8 c0a1c524 00000000 00000000 00000000 00000000
[    4.626216] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.634429] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
[    4.642637] Backtrace:
[    4.645104] [<c07d3f28>] (v4l2_async_register_subdev) from [<c07e569c>] (gs2971_probe+0x3f0/0x418)
[    4.654105]  r9:c0e44950 r8:00000026 r7:c1204c48 r6:c1290d1c r5:ee4cd000 r4:ee456400
[    4.661891] [<c07e52ac>] (gs2971_probe) from [<c074b6ec>] (spi_drv_probe+0x84/0xa8)
[    4.669584]  r10:00000000 r9:c124297c r8:00000000 r7:00000000 r6:c124296c r5:00000000
[    4.677447]  r4:ee456400
[    4.679998] [<c074b668>] (spi_drv_probe) from [<c06b2f90>] (really_probe+0x204/0x2c0)
[    4.687863]  r7:00000000 r6:c128f2b4 r5:ee456400 r4:c128f2b0
[    4.693552] [<c06b2d8c>] (really_probe) from [<c06b31f0>] (driver_probe_device+0x68/0x180)
[    4.701855]  r10:c10626e0 r9:c104c834 r8:00000000 r7:c06b3308 r6:ee456434 r5:c124297c
[    4.709718]  r4:ee456400 r3:00000000
[    4.713313] [<c06b3188>] (driver_probe_device) from [<c06b33ec>] (__driver_attach+0xe4/0xe8)
[    4.721788]  r9:c104c834 r8:00000000 r7:c06b3308 r6:ee456434 r5:c124297c r4:ee456400
[    4.729570] [<c06b3308>] (__driver_attach) from [<c06b1080>] (bus_for_each_dev+0x7c/0xbc)
[    4.737784]  r7:c06b3308 r6:c124297c r5:c1204c48 r4:eeb3fbb4
[    4.743471] [<c06b1004>] (bus_for_each_dev) from [<c06b28c8>] (driver_attach+0x24/0x28)
[    4.751510]  r7:00000000 r6:ee4cb100 r5:c123c358 r4:c124297c
[    4.757198] [<c06b28a4>] (driver_attach) from [<c06b2364>] (bus_add_driver+0x1c4/0x208)
[    4.765241] [<c06b21a0>] (bus_add_driver) from [<c06b3dd0>] (driver_register+0x7c/0x110)
[    4.773367]  r7:c102e05c r6:ffffe000 r5:c1204c48 r4:c124297c
[    4.779055] [<c06b3d54>] (driver_register) from [<c074b628>] (__spi_register_driver+0x60/0x64)
[    4.787703]  r5:c1204c48 r4:c1254100
[    4.791298] [<c074b5c8>] (__spi_register_driver) from [<c102e074>] (gs2971_init+0x18/0x20)
[    4.799604] [<c102e05c>] (gs2971_init) from [<c02025b8>] (do_one_initcall+0x84/0x1b0)
[    4.807474] [<c0202534>] (do_one_initcall) from [<c1000ff4>] (kernel_init_freeable+0x1c4/0x258)
[    4.816212]  r8:c104c854 r7:c10004f0 r6:c1254100 r5:c1254100 r4:00000007
[    4.822948] [<c1000e30>] (kernel_init_freeable) from [<c0a1c528>] (kernel_init+0x10/0x11c)
[    4.831251]  r10:00000000 r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c0a1c518
[    4.839112]  r4:00000000
[    4.841659] [<c0a1c518>] (kernel_init) from [<c02010d8>] (ret_from_fork+0x14/0x3c)
[    4.849260] Exception stack(0xef08ffb0 to 0xef08fff8)
[    4.854333] ffa0:                                     00000000 00000000 00000000 00000000
[    4.862546] ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[    4.870758] ffe0: 00000000 00000000 00000000 00000000 00000013 00000000
[    4.877400]  r5:c0a1c518 r4:00000000
[    4.880993] Code: e89da830 e1a0c00d e92ddbf0 e24cb004 (e59030a8)
[    4.887155] ---[ end trace 9b4c4574316da2dc ]---
[    4.891807] Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    4.891807]
[    4.900990] CPU1: stopping
[    4.903715] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G      D           4.19.59-g5f8c1c6121 #32
[    4.912276] Hardware name: Generic DRA74X (Flattened Device Tree)
[    4.918394] Backtrace:
[    4.920862] [<c020ca34>] (dump_backtrace) from [<c020cd6c>] (show_stack+0x18/0x1c)
[    4.928467]  r7:ef0c5f08 r6:60000193 r5:00000000 r4:c12509dc
[    4.934156] [<c020cd54>] (show_stack) from [<c0a082a0>] (dump_stack+0x90/0xa4)
[    4.941414] [<c0a08210>] (dump_stack) from [<c020f6b8>] (handle_IPI+0x1b0/0x1dc)
[    4.948843]  r7:ef0c5f08 r6:00000001 r5:00000000 r4:c106acfc
[    4.954532] [<c020f508>] (handle_IPI) from [<c05513e4>] (gic_handle_irq+0x7c/0x80)
[    4.962135]  r6:fa212000 r5:fa21200c r4:c1205100
[    4.966775] [<c0551368>] (gic_handle_irq) from [<c02019f8>] (__irq_svc+0x58/0x8c)
[    4.974289] Exception stack(0xef0c5f08 to 0xef0c5f50)
[    4.979364] 5f00:                   00000000 00000614 ef64950c c021a960 ffffe000 c1204c7c
[    4.987578] 5f20: c1204cc4 00000002 00000000 00000000 c106a4f0 ef0c5f64 ef0c5f68 ef0c5f58
[    4.995791] 5f40: c0208ea8 c0208eac 60000013 ffffffff
[    5.000866]  r9:ef0c4000 r8:00000000 r7:ef0c5f3c r6:ffffffff r5:60000013 r4:c0208eac
[    5.008649] [<c0208e6c>] (arch_cpu_idle) from [<c0a2222c>] (default_idle_call+0x30/0x34)
[    5.016779] [<c0a221fc>] (default_idle_call) from [<c025a5e0>] (do_idle+0x20c/0x2b4)
[    5.024560] [<c025a3d4>] (do_idle) from [<c025a974>] (cpu_startup_entry+0x20/0x24)
[    5.032165]  r10:00000000 r9:412fc0f2 r8:80007000 r7:c1254390 r6:00000001 r5:ef0c4000
[    5.040026]  r4:00000087
[    5.042574] [<c025a954>] (cpu_startup_entry) from [<c020f25c>] (secondary_start_kernel+0x174/0x180)
[    5.051661] [<c020f0e8>] (secondary_start_kernel) from [<8020236c>] (0x8020236c)
[    5.059090]  r7:c1254390 r6:30c0387d r5:00000000 r4:af077180
[    5.064781] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
[    5.064781]  ]---

without adding v4l2_subdev_init,v4l2_async_register_subdev but not showing the video1

U-Boot SPL 2019.01 (Nov 16 2021 - 15:24:57 +0530)
DRA752-GP ES2.0
Trying to boot from MMC1
no pinctrl state for default mode
no pinctrl state for default mode
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Loading Environment from MMC... Card did not respond to voltage select!
*** Warning - No block device, using default environment



U-Boot 2019.01 (Nov 16 2021 - 15:24:57 +0530)

CPU  : DRA752-GP ES2.0
Model: TI AM5728 BeagleBoard-X15
Board: CARAVEL-DECODER AM572x EVM REV
DRAM:  1 GiB
MMC:   OMAP SD/MMC: 0
Loading Environment from FAT... *** Warning - bad CRC, using default environment

Loading Environment from MMC... MMC Device 1 not found
*** Warning - No MMC card found, using default environment

Warning: fastboot.board_rev: unknown board revision
invalid mmc device
Net:
Warning: ethernet@48484000 using MAC address from ROM
eth0: ethernet@48484000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
** Unable to read file boot.scr **
1490 bytes read in 1 ms (1.4 MiB/s)
Loaded env from uEnv.txt
Importing environment from mmc0 ...
Running uenvcmd ...
1 bytes read in 3 ms (0 Bytes/s)
Already setup.
switch to partitions #0, OK
mmc0 is current device
SD/MMC found on device 0
4436480 bytes read in 197 ms (21.5 MiB/s)
135414 bytes read in 8 ms (16.1 MiB/s)
## Flattened Device Tree blob at 88000000
   Booting using the fdt blob at 0x88000000
   Loading Device Tree to 8ffdb000, end 8ffff0f5 ... OK

Starting kernel ...

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 4.19.59-g5f8c1c6121 (root@ubuntu-OptiPlex-3040) (gcc version 8.3.0 (GNU Toolchain for the A-profile Architecture 8.3-2019.03 (arm-rel-8.36))) #33 SMP PREEMPT Tue Nov 16 20:23:06 IST 2021
[    0.000000] CPU: ARMv7 Processor [412fc0f2] revision 2 (ARMv7), cr=30c5387d
[    0.000000] CPU: div instructions available: patching division code
[    0.000000] CPU: PIPT / VIPT nonaliasing data cache, PIPT instruction cache
[    0.000000] OF: fdt: Machine model: TI AM5728 EVM
[    0.000000] Memory policy: Data cache writealloc
[    0.000000] efi: Getting EFI parameters from FDT:
[    0.000000] efi: UEFI not found.
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000095800000, size 56 MiB
[    0.000000] OF: reserved mem: initialized node ipu2-memory@95800000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x0000000099000000, size 64 MiB
[    0.000000] OF: reserved mem: initialized node dsp1-memory@99000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009d000000, size 32 MiB
[    0.000000] OF: reserved mem: initialized node ipu1-memory@9d000000, compatible id shared-dma-pool
[    0.000000] Reserved memory: created CMA memory pool at 0x000000009f000000, size 8 MiB
[    0.000000] OF: reserved mem: initialized node dsp2-memory@9f000000, compatible id shared-dma-pool
[    0.000000] cma: Reserved 24 MiB at 0x00000000be400000
[    0.000000] OMAP4: Map 0x00000000bfd00000 to (ptrval) for dram barrier
[    0.000000] DRA752 ES2.0
[    0.000000] random: get_random_bytes called from start_kernel+0xc0/0x47c with crng_init=0
[    0.000000] percpu: Embedded 16 pages/cpu s36492 r8192 d20852 u65536
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 259648
[    0.000000] Kernel command line: console=ttyS2,115200n8 root=PARTUUID=3d843c32-02 rw rootfstype=ext4 rootwait
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Memory: 829144K/1045504K available (10240K kernel code, 336K rwdata, 2792K rodata, 2048K init, 276K bss, 27944K reserved, 188416K cma-reserved, 234496K highmem)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0xffff0000 - 0xffff1000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xfff00000   (3072 kB)
[    0.000000]     vmalloc : 0xf0800000 - 0xff800000   ( 240 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf0000000   ( 768 MB)
[    0.000000]     pkmap   : 0xbfe00000 - 0xc0000000   (   2 MB)
[    0.000000]     modules : 0xbf000000 - 0xbfe00000   (  14 MB)
[    0.000000]       .text : 0x(ptrval) - 0x(ptrval)   (12256 kB)
[    0.000000]       .init : 0x(ptrval) - 0x(ptrval)   (2048 kB)
[    0.000000]       .data : 0x(ptrval) - 0x(ptrval)   ( 337 kB)
[    0.000000]        .bss : 0x(ptrval) - 0x(ptrval)   ( 277 kB)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
[    0.000000] rcu: Preemptible hierarchical RCU implementation.
[    0.000000]  Tasks RCU enabled.
[    0.000000] NR_IRQS: 16, nr_irqs: 16, preallocated irqs: 16
[    0.000000] GIC: Using split EOI/Deactivate mode
[    0.000000] OMAP clockevent source: timer1 at 32786 Hz
[    0.000000] arch_timer: cp15 timer(s) running at 6.14MHz (phys).
[    0.000000] clocksource: arch_sys_counter: mask: 0xffffffffffffff max_cycles: 0x16af5adb9, max_idle_ns: 440795202250 ns
[    0.000005] sched_clock: 56 bits at 6MHz, resolution 162ns, wraps every 4398046511023ns
[    0.000018] Switching to timer-based delay loop, resolution 162ns
[    0.000906] clocksource: 32k_counter: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 58327039986419 ns
[    0.000915] OMAP clocksource: 32k_counter at 32768 Hz
[    0.002419] Console: colour dummy device 80x30
[    0.002467] Calibrating delay loop (skipped), value calculated using timer frequency.. 12.29 BogoMIPS (lpj=61475)
[    0.002484] pid_max: default: 32768 minimum: 301
[    0.002608] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.002624] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.003208] CPU: Testing write buffer coherency: ok
[    0.003249] CPU0: Spectre v2: using ICIALLU workaround
[    0.003476] /cpus/cpu@0 missing clock-frequency property
[    0.003497] /cpus/cpu@1 missing clock-frequency property
[    0.003510] CPU0: thread -1, cpu 0, socket 0, mpidr 80000000
[    0.059890] Setting up static identity map for 0x80200000 - 0x80200060
[    0.079899] rcu: Hierarchical SRCU implementation.
[    0.100092] EFI services will not be available.
[    0.119958] smp: Bringing up secondary CPUs ...
[    0.200293] CPU1: thread -1, cpu 1, socket 0, mpidr 80000001
[    0.200299] CPU1: Spectre v2: using ICIALLU workaround
[    0.200422] smp: Brought up 1 node, 2 CPUs
[    0.200434] SMP: Total of 2 processors activated (24.59 BogoMIPS).
[    0.200444] CPU: All CPU(s) started in HYP mode.
[    0.200452] CPU: Virtualization extensions available.
[    0.200958] devtmpfs: initialized
[    0.221959] VFP support v0.3: implementor 41 architecture 4 part 30 variant f rev 0
[    0.222242] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.222260] futex hash table entries: 512 (order: 3, 32768 bytes)
[    0.225545] pinctrl core: initialized pinctrl subsystem
[    0.226075] DMI not present or invalid.
[    0.226362] NET: Registered protocol family 16
[    0.227533] DMA: preallocated 256 KiB pool for atomic coherent allocations
[    0.228500] omap_hwmod: l3_main_2 using broken dt data from ocp
[    0.421268] cpuidle: using governor ladder
[    0.421304] cpuidle: using governor menu
[    0.431868] OMAP GPIO hardware version 0.1
[    0.456364] No ATAGs?
[    0.456441] hw-breakpoint: found 5 (+1 reserved) breakpoint and 4 watchpoint registers.
[    0.456456] hw-breakpoint: maximum watchpoint size is 8 bytes.
[    0.457023] omap4_sram_init:Unable to allocate sram needed to handle errata I688
[    0.457036] omap4_sram_init:Unable to get sram pool needed to handle errata I688
[    0.457676] OMAP DMA hardware revision 0.0
[    0.469374] edma 43300000.edma: memcpy is disabled
[    0.472881] edma 43300000.edma: TI EDMA DMA engine driver
[    0.480190] omap-dma-engine 4a056000.dma-controller: OMAP DMA engine driver (LinkedList1/2/3 supported)
[    0.481563] evm_5v0: supplied by main_12v0
[    0.481952] com_3v6: supplied by evm_5v0
[    0.485006] omap-iommu 40d01000.mmu: 40d01000.mmu registered
[    0.485189] omap-iommu 40d02000.mmu: 40d02000.mmu registered
[    0.485434] omap-iommu 58882000.mmu: 58882000.mmu registered
[    0.485671] omap-iommu 55082000.mmu: 55082000.mmu registered
[    0.486042] omap-iommu 41501000.mmu: 41501000.mmu registered
[    0.486212] omap-iommu 41502000.mmu: 41502000.mmu registered
[    0.486492] iommu: Adding device 58820000.ipu to group 1
[    0.486577] iommu: Adding device 55020000.ipu to group 2
[    0.486705] iommu: Adding device 40800000.dsp to group 0
[    0.486938] iommu: Adding device 41000000.dsp to group 3
[    0.488151] SCSI subsystem initialized
[    0.489221] palmas 0-0058: Irq flag is 0x00000008
[    0.512784] palmas 0-0058: Muxing GPIO 2f, PWM 0, LED 0
[    0.514381] SMPS12: supplied by regulator-dummy
[    0.516046] SMPS3: supplied by regulator-dummy
[    0.517709] SMPS45: supplied by regulator-dummy
[    0.519526] SMPS6: supplied by regulator-dummy
[    0.520962] SMPS7: supplied by regulator-dummy
[    0.522347] SMPS8: supplied by regulator-dummy
[    0.523613] SMPS9: supplied by regulator-dummy
[    0.524298] LDO1: supplied by regulator-dummy
[    0.531163] random: fast init done
[    0.531317] LDO2: supplied by regulator-dummy
[    0.541164] LDO3: supplied by regulator-dummy
[    0.551166] LDO4: supplied by regulator-dummy
[    0.561187] LDO5: supplied by regulator-dummy
[    0.561878] LDO6: supplied by regulator-dummy
[    0.562582] LDO7: supplied by regulator-dummy
[    0.563277] LDO8: supplied by regulator-dummy
[    0.563965] LDO9: supplied by regulator-dummy
[    0.571224] LDOLN: supplied by regulator-dummy
[    0.581233] LDOUSB: supplied by regulator-dummy
[    0.593280] omap_i2c 48070000.i2c: bus 0 rev0.12 at 400 kHz
[    0.593880] omap_i2c 4807c000.i2c: bus 4 rev0.12 at 400 kHz
[    0.594097] media: Linux media interface: v0.10
[    0.594136] videodev: Linux video capture interface: v2.00
[    0.594212] pps_core: LinuxPPS API ver. 1 registered
[    0.594221] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.594243] PTP clock support registered
[    0.594277] EDAC MC: Ver: 3.0.0
[    0.595311] Advanced Linux Sound Architecture Driver Initialized.
[    0.596077] clocksource: Switched to clocksource arch_sys_counter
[    0.604237] NET: Registered protocol family 2
[    0.604817] tcp_listen_portaddr_hash hash table entries: 512 (order: 0, 6144 bytes)
[    0.604847] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.604911] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.605037] TCP: Hash tables configured (established 8192 bind 8192)
[    0.605116] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.605152] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.605283] NET: Registered protocol family 1
[    0.625726] RPC: Registered named UNIX socket transport module.
[    0.625737] RPC: Registered udp transport module.
[    0.625746] RPC: Registered tcp transport module.
[    0.625754] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.626830] hw perfevents: no interrupt-affinity property for /pmu, guessing.
[    0.627052] hw perfevents: enabled with armv7_cortex_a15 PMU driver, 7 counters available
[    0.628016] Initialise system trusted keyrings
[    0.628147] workingset: timestamp_bits=14 max_order=18 bucket_order=4
[    0.632953] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.643448] NFS: Registering the id_resolver key type
[    0.643473] Key type id_resolver registered
[    0.643482] Key type id_legacy registered
[    0.643523] ntfs: driver 2.1.32 [Flags: R/O].
[    0.645121] Key type asymmetric registered
[    0.645133] Asymmetric key parser 'x509' registered
[    0.645181] bounce: pool size: 64 pages
[    0.645215] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 245)
[    0.645226] io scheduler noop registered
[    0.645235] io scheduler deadline registered
[    0.645334] io scheduler cfq registered (default)
[    0.645345] io scheduler mq-deadline registered
[    0.645355] io scheduler kyber registered
[    0.651225] pinctrl-single 4a003400.pinmux: 282 pins, size 1128
[    0.655371] dra7-pcie 51000000.pcie: Linked as a consumer to phy-4a094000.pciephy.1
[    0.655632] dra7-pcie 51000000.pcie: WA for Errata i870 not applied
[    0.655724] dra7-pcie 51000000.pcie: host bridge /ocp/axi@0/pcie@51000000 ranges:
[    0.655764] dra7-pcie 51000000.pcie:    IO 0x20003000..0x20012fff -> 0x00000000
[    0.655791] dra7-pcie 51000000.pcie:   MEM 0x20013000..0x2fffffff -> 0x20013000
[    1.656081] dra7-pcie 51000000.pcie: Phy link never came up
[    1.656212] dra7-pcie 51000000.pcie: PCI host bridge to bus 0000:00
[    1.656227] pci_bus 0000:00: root bus resource [bus 00-ff]
[    1.656239] pci_bus 0000:00: root bus resource [io  0x0000-0xffff]
[    1.656251] pci_bus 0000:00: root bus resource [mem 0x20013000-0x2fffffff]
[    1.662864] PCI: bus0: Fast back to back transfers disabled
[    1.669046] PCI: bus1: Fast back to back transfers enabled
[    1.669090] pci 0000:00:00.0: BAR 0: assigned [mem 0x20100000-0x201fffff 64bit]
[    1.669109] pci 0000:00:00.0: PCI bridge to [bus 01-ff]
[    1.669436] pcieport 0000:00:00.0: Signaling PME with IRQ 166
[    1.669572] pcieport 0000:00:00.0: AER enabled with IRQ 166
[    1.670689] pwm-backlight backlight: backlight supply power not found, using dummy regulator
[    1.670766] pwm-backlight backlight: Linked as a consumer to regulator.0
[    1.673891] vdd_3v3: supplied by regen1
[    1.674126] aic_dvdd_fixed: supplied by vdd_3v3
[    1.674190] vtt_fixed: supplied by smps3
[    1.718887] Serial: 8250/16550 driver, 10 ports, IRQ sharing enabled
[    1.722443] console [ttyS2] disabled
[    1.722502] 48020000.serial: ttyS2 at MMIO 0x48020000 (irq = 45, base_baud = 3000000) is a 8250
[    2.828160] console [ttyS2] enabled
[    2.832562] 48422000.serial: ttyS7 at MMIO 0x48422000 (irq = 46, base_baud = 3000000) is a 8250
[    2.843743] omap_rng 48090000.rng: Random Number Generator ver. 20
[    2.844058] random: crng init done
[    2.850882] omapdss_dss 58000000.dss: 58000000.dss supply vdda_video not found, using dummy regulator
[    2.862765] omapdss_dss 58000000.dss: Linked as a consumer to regulator.0
[    2.869813] omapdss_dss 58000000.dss: Dropping the link to regulator.0
[    2.881916] panel-simple display: display supply power not found, using dummy regulator
[    2.890027] panel-simple display: Linked as a consumer to regulator.0
[    2.904724] brd: module loaded
[    2.914218] loop: module loaded
[    2.922013] libphy: Fixed MDIO Bus: probed
[    2.986102] davinci_mdio 48485000.mdio: davinci mdio revision 1.6, bus freq 1000000
[    2.993796] libphy: 48485000.mdio: probed
[    3.001109] mdio_bus 48485000.mdio: MDIO device at address 2 is missing.
[    3.007864] davinci_mdio 48485000.mdio: phy[1]: device 48485000.mdio:01, driver Micrel KSZ9031 Gigabit PHY
[    3.018116] cpsw 48484000.ethernet: Detected MACID = 88:3f:4a:bc:56:06
[    3.024714] cpsw 48484000.ethernet: initialized cpsw ale version 1.4
[    3.031117] cpsw 48484000.ethernet: ALE Table size 1024
[    3.036424] cpsw 48484000.ethernet: cpts: overflow check period 500 (jiffies)
[    3.044420] cpsw 48484000.ethernet: cpsw: Detected MACID = 88:3f:4a:bc:56:07
[    3.052728] i2c /dev entries driver
[    3.057133] gs2971 spi3.2: mclk=19bfcc0
[    3.060991] gs2971 spi3.2: ipu=0
[    3.064234] gs2971 spi3.2: ipu missing or invalid
[    3.068977] gs2971_probe:cea861=0
[    3.072311] gs2971_gpio_state: active=0, standby-gpios(0)=0x0
[    4.156296] gs2971 spi3.2: status=0, read value of 0x000000c0, expected 0x000000c0
[    4.164295] gs2971 spi3.2: register 00 = 000000c0
[    4.169111] gs2971 spi3.2: register 01 = 00000000
[    4.173904] gs2971 spi3.2: register 02 = 00000000
[    4.178716] gs2971 spi3.2: register 03 = 00000000
[    4.183510] gs2971 spi3.2: register 04 = 00000000
[    4.188320] gs2971 spi3.2: register 05 = 00004210
[    4.193126] gs2971 spi3.2: register 06 = 00001dff
[    4.197939] gs2971 spi3.2: register 07 = 00001dff
[    4.202731] gs2971 spi3.2: register 08 = 00000820
[    4.207543] gs2971 spi3.2: register 09 = 00001883
[    4.212335] gs2971 spi3.2: register 0a = 00000000
[    4.217146] gs2971 spi3.2: register 0b = 00000000
[    4.221937] gs2971 spi3.2: register 0c = 00000000
[    4.226747] gs2971 spi3.2: register 0d = 00000000
[    4.231539] gs2971 spi3.2: register 0e = 00000000
[    4.236349] gs2971 spi3.2: register 0f = 00000000
[    4.241141] gs2971 spi3.2: register 10 = 00000000
[    4.245932] gs2971 spi3.2: register 11 = 00000000
[    4.250743] gs2971 spi3.2: register 12 = 00000000
[    4.255535] gs2971 spi3.2: register 13 = 00000000
[    4.260359] gs2971 spi3.2: register 14 = 00000000
[    4.265150] gs2971 spi3.2: register 15 = 00000000
[    4.269961] gs2971 spi3.2: register 16 = 00000000
[    4.274753] gs2971 spi3.2: register 17 = 00000000
[    4.279576] gs2971 spi3.2: register 18 = 00000000
[    4.284367] gs2971 spi3.2: register 19 = 00000000
[    4.289179] gs2971 spi3.2: register 1a = 00000000
[    4.293985] gs2971 spi3.2: register 1b = 00000000
[    4.298795] gs2971 spi3.2: register 1c = 00000000
[    4.303587] gs2971 spi3.2: register 1d = 00000000
[    4.308396] gs2971 spi3.2: register 1e = 00000000
[    4.313200] gs2971 spi3.2: register 1f = 00000000
[    4.318011] gs2971 spi3.2: register 20 = 00000000
[    4.322801] gs2971 spi3.2: register 21 = 00000000
[    4.327610] gs2971 spi3.2: register 22 = 00008000
[    4.332403] gs2971 spi3.2: register 23 = 00000000
[    4.337227] gs2971 spi3.2: register 24 = 00000004
[    4.342017] gs2971 spi3.2: register 25 = 00000040
[    4.346762] gs2971_gpio_state: active=1, standby-gpios(0)=0x1
[    4.354980] gpio-fan gpio_fan: GPIO fan initialized
[    4.360587] tmp102 0-0048: error reading config register
[    4.366023] tmp102: probe of 0-0048 failed with error -121
[    4.374662] cpu cpu0: Linked as a consumer to regulator.8
[    4.380202] cpu cpu0: Linked as a consumer to regulator.31
[    4.387361] sdhci: Secure Digital Host Controller Interface driver
[    4.393570] sdhci: Copyright(c) Pierre Ossman
[    4.399404] sdhci-pltfm: SDHCI platform and OF driver helper
[    4.405733] omap_gpio 4805d000.gpio: Could not set line 27 debounce to 200000 microseconds (-22)
[    4.414566] sdhci-omap 4809c000.mmc: Got CD GPIO
[    4.419387] sdhci-omap 4809c000.mmc: Linked as a consumer to regulator.30
[    4.426252] sdhci-omap 4809c000.mmc: 4809c000.mmc supply vqmmc not found, using dummy regulator
[    4.435019] sdhci-omap 4809c000.mmc: Linked as a consumer to regulator.0
[    4.441814] sdhci-omap 4809c000.mmc: Dropping the link to regulator.0
[    4.448494] sdhci-omap 4809c000.mmc: Linked as a consumer to regulator.15
[    4.455443] sdhci-omap 4809c000.mmc: no pinctrl state for ddr_3_3v mode
[    4.488965] mmc0: SDHCI controller on 4809c000.mmc [4809c000.mmc] using ADMA
[    4.497154] sdhci-omap 480b4000.mmc: Linked as a consumer to regulator.5
[    4.503984] sdhci-omap 480b4000.mmc: Dropping the link to regulator.5
[    4.510754] sdhci-omap 480b4000.mmc: Linked as a consumer to regulator.5
[    4.543579] mmc1: SDHCI controller on 480b4000.mmc [480b4000.mmc] using ADMA
[    4.551232] sdhci-omap 480ad000.mmc: Linked as a consumer to regulator.1
[    4.558046] sdhci-omap 480ad000.mmc: Dropping the link to regulator.1
[    4.564591] sdhci-omap 480ad000.mmc: Linked as a consumer to regulator.2
[    4.571531] sdhci-omap 480ad000.mmc: Linked as a consumer to regulator.1
[    4.578066] mmc0: host does not support reading read-only switch, assuming write-enable
[    4.578386] sdhci-omap 480ad000.mmc: no pinctrl state for sdr104 mode
[    4.592846] sdhci-omap 480ad000.mmc: no pinctrl state for ddr50 mode
[    4.599275] sdhci-omap 480ad000.mmc: no pinctrl state for hs200_1_8v mode
[    4.608817] mmc0: new high speed SDHC card at address aaaa
[    4.625007] mmcblk0: mmc0:aaaa SC32G 29.7 GiB
[    4.629522] mmc2: SDHCI controller on 480ad000.mmc [480ad000.mmc] using PIO
[    4.638689] ledtrig-cpu: registered to indicate activity on CPUs
[    4.644912]  mmcblk0: p1 p2
[    4.653023] NET: Registered protocol family 10
[    4.658198] Segment Routing with IPv6
[    4.661928] sit: IPv6, IPv4 and MPLS over IPv4 tunneling driver
[    4.668239] NET: Registered protocol family 17
[    4.672882] Key type dns_resolver registered
[    4.677294] Registering SWP/SWPB emulation handler
[    4.682122] omap_voltage_late_init: Voltage driver support not added
[    4.688537] Power Management for TI OMAP4+ devices.
[    4.693961] Loading compiled-in X.509 certificates
[    4.716572] dmm 4e000000.dmm: workaround for errata i878 in use
[    4.723907] dmm 4e000000.dmm: initialized all PAT entries
[    4.729971] omapdss_dss 58000000.dss: 58000000.dss supply vdda_video not found, using dummy regulator
[    4.739326] omapdss_dss 58000000.dss: Linked as a consumer to regulator.0
[    4.746327] DSS: OMAP DSS rev 6.1
[    4.750563] omapdss_dss 58000000.dss: bound 58001000.dispc (ops dispc_component_ops)
[    4.786494] [drm] Supports vblank timestamp caching Rev 2 (21.10.2013).
[    4.793137] [drm] No driver support for vblank timestamp query.
[    4.801896] [drm] Enabling DMM ywrap scrolling
[    4.876885] Console: switching to colour frame buffer device 100x30
[    4.885991] omapdrm omapdrm.0: fb0: omapdrm frame buffer device
[    4.892640] [drm] Initialized omapdrm 1.0.0 20110917 for omapdrm.0 on minor 0
[    4.901163] input: gpio_keys as /devices/platform/gpio_keys/input/input0
[    4.908360] hctosys: unable to open rtc device (rtc0)
[    4.914043] aic_dvdd_fixed: disabling
[    4.917898] ldousb: disabling
[    4.921147] ALSA device list:
[    4.924123]   No soundcards found.
[    4.951376] EXT4-fs (mmcblk0p2): mounted filesystem with ordered data mode. Opts: (null)
[    4.959562] VFS: Mounted root (ext4 filesystem) on device 179:2.
[    4.976572] devtmpfs: mounted
[    4.980501] Freeing unused kernel memory: 2048K
[    4.985146] Run /sbin/init as init process
[    5.362688] systemd[1]: System time before build time, advancing clock.
[    5.399238] systemd[1]: systemd 239 running in system mode. (+PAM -AUDIT -SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP -LIBCRYPTSETUP -GCRYPT -GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID -ELFUTILS +KMOD -IDN2 -IDN -PCRE2 default-hierarchy=hybrid)
[    5.421891] systemd[1]: Detected architecture arm.

Welcome to Arago 2019.07!

[    5.459036] systemd[1]: Set hostname to <am57xx-evm>.
[    5.643360] systemd[1]: File /lib/systemd/system/systemd-journald.service:36 configures an IP firewall (IPAddressDeny=any), but the local system does not support BPF/cgroup based firewalling.
[    5.660655] systemd[1]: Proceeding WITHOUT firewalling in effect! (This warning is only shown for the first loaded unit using IP firewalling.)
[    5.894383] systemd[1]: Listening on Journal Socket.
[  OK  ] Listening on Journal Socket.
[    5.927307] systemd[1]: Listening on initctl Compatibility Named Pipe.
[  OK  ] Listening on initctl Compatibility Named Pipe.
[    5.969550] systemd[1]: Created slice system-getty.slice.
[  OK  ] Created slice system-getty.slice.
[    6.002756] systemd[1]: Starting Create list of required static device nodes for the current kernel...
         Starting Create list of required st…ce nodes for the current kernel...
[    6.050206] systemd[1]: Mounting POSIX Message Queue File System...
         Mounting POSIX Message Queue File System...
         Mounting Kernel Debug File System...
[  OK  ] Started Forward Password Requests to Wall Directory Watch.
[  OK  ] Listening on Journal Socket (/dev/log).
[  OK  ] Reached target Remote File Systems.
[  OK  ] Listening on udev Kernel Socket.
[  OK  ] Started Hardware RNG Entropy Gatherer Daemon.
[  OK  ] Listening on Network Service Netlink Socket.
[  OK  ] Created slice system-serial\x2dgetty.slice.
         Starting Load Kernel Modules...
[    6.391021] cmemk: loading out-of-tree module taints kernel.
[  OK  ] Listening on udev Control Socket.
[    6.397689] CMEMK module: reference Linux version 4.19.59
[    6.408204] CMEMK Error: Error sub device node not available
[    6.413889] CMEMK Error: bad DT config
         Starting udev Coldplug all Devices...
[  OK  ] Reached target Swap.
[  OK  ] Listening on Process Core Dump Socket.
[    6.525250] cryptodev: driver 1.9 loaded.
         Mounting Temporary Directory (/tmp)...
         Starting Journal Service...
[  OK  ] Created slice User and Session Slice.
[    6.603926] usbcore: registered new interface driver usbfs
[    6.609941] usbcore: registered new interface driver hub
[    6.615354] usbcore: registered new device driver usb
[  OK  ] Reached target Slices.
[    6.636784] usbcore: registered new interface driver ftdi_sio
[    6.642605] usbserial: USB Serial support registered for FTDI USB Serial Device
[  OK  ] Started Dispatch Password Requests to Console Directory Watch.
[  OK  ] Reached target Paths.
         Starting Remount Root and Kernel File Systems...
[    6.738060] EXT4-fs (mmcblk0p2): re-mounted. Opts: (null)
[  OK  ] Started Journal Service.
[  OK  ] Started Create list of required sta…vice nodes for the current kernel.
[  OK  ] Mounted POSIX Message Queue File System.
[  OK  ] Mounted Kernel Debug File System.
[FAILED] Failed to start Load Kernel Modules.
See 'systemctl status systemd-modules-load.service' for details.
[  OK  ] Mounted Temporary Directory (/tmp).
[  OK  ] Started Remount Root and Kernel File Systems.
         Starting Apply Kernel Variables...
         Mounting Kernel Configuration File System...
         Starting Create Static Device Nodes in /dev...
         Starting Flush Journal to Persistent Storage...
[  OK  ] Started Apply Kernel Variables.
[  OK  ] Mounted Kernel Configuration File System.
[  OK  ] Started Create Static Device Nodes in /dev.
[    7.244133] systemd-journald[97]: Received request to flush runtime journal from PID 1
         Starting udev Kernel Device Manager...
[  OK  ] Reached target Local File Systems (Pre).
         Mounting /media/ram...
         Mounting /var/volatile...
[  OK  ] Reached target Containers.
[  OK  ] Started udev Kernel Device Manager.
[  OK  ] Started Flush Journal to Persistent Storage.
[  OK  ] Mounted /media/ram.
[  OK  ] Started udev Coldplug all Devices.
[  OK  ] Mounted /var/volatile.
[    7.565898] omap-rproc 58820000.ipu: ignoring dependency for device, assuming no driver
[    7.605892] omap-rproc 58820000.ipu: ignoring dependency for device, assuming no driver
         [    7.618248] omap-rproc 58820000.ipu: assigned reserved memory node ipu1-memory@9d000000
Starting Load/Save Random Seed...
[    7.630249] remoteproc remoteproc0: 58820000.ipu is available
[    7.640526] omap-rproc 55020000.ipu: ignoring dependency for device, assuming no driver
[    7.650627] omap-rproc 55020000.ipu: ignoring dependency for device, assuming no driver
[    7.667772] omap-rproc 55020000.ipu: assigned reserved memory node ipu2-memory@95800000
[  OK  ] Reached target Local File Systems.
         Starting Create Volatile Files and Directories...
[    7.715431] remoteproc remoteproc1: 55020000.ipu is available
[  OK  ] Started Load/Save Random Seed.
[    7.752389] omap-rproc 40800000.dsp: ignoring dependency for device, assuming no driver
[    7.800329] omap-rproc 40800000.dsp: ignoring dependency for device, assuming no driver
[    7.839795] omap-rproc 40800000.dsp: assigned reserved memory node dsp1-memory@99000000
[    7.886309] remoteproc remoteproc2: 40800000.dsp is available
[  OK  ] Found device /dev/ttyS2.
[    7.910878] omap-rproc 41000000.dsp: ignoring dependency for device, assuming no driver
[    7.926608] omap-rproc 41000000.dsp: ignoring dependency for device, assuming no driver
[    7.954452] omap-rproc 41000000.dsp: assigned reserved memory node dsp2-memory@9f000000
[    7.964949] remoteproc remoteproc3: 41000000.dsp is available
[  OK  ] Started Create Volatile Files and Directories.
         Starting Network Service...
         Starting Update UTMP about System Boot/Shutdown...
         Starting Network Time Synchronization...
[    8.165084] remoteproc remoteproc1: powering up 55020000.ipu
[    8.179873] remoteproc remoteproc1: Booting fw image dra7-ipu2-fw.xem4, size 3747220
[    8.204119] omap-iommu 55082000.mmu: 55082000.mmu: version 2.1
[  OK  ] Started Update UTMP about System Boot/Shutdown.
[    8.284920] omap-rproc 55020000.ipu: mbox_request_channel failed: -517
[    8.291665] remoteproc remoteproc1: can't start rproc 55020000.ipu: -16
[    8.330621] Driver for 1-wire Dallas network protocol.
[    8.395947] remoteproc remoteproc0: powering up 58820000.ipu
[    8.401750] remoteproc remoteproc0: Booting fw image dra7-ipu1-fw.xem4, size 6726740
[    8.410652] omap-iommu 58882000.mmu: 58882000.mmu: version 2.1
[    8.426914] omap-rproc 58820000.ipu: mbox_request_channel failed: -517
[    8.433474] remoteproc remoteproc0: can't start rproc 58820000.ipu: -16
[    8.444904] remoteproc remoteproc0: failed to unmap 16777216/0
[    8.451474] remoteproc remoteproc0: failed to unmap 16777216/0
[    8.461331] remoteproc remoteproc0: failed to unmap 16777216/0
[    8.483850] omap_rtc 48838000.rtc: registered as rtc0
[    8.603608] tlv320aic3x-codec 0-0018: Linked as a consumer to regulator.5
[    8.606151] omap_hdq 480b2000.1w: OMAP HDQ Hardware Rev 0.:. Driver in Interrupt mode
[    8.616165] tlv320aic3x-codec 0-0018: Linked as a consumer to regulator.6
[    8.774844] omap-des 480a5000.des: OMAP DES hw accel rev: 2.2
[    8.785171] omap-des 480a5000.des: will run requests pump with realtime priority
[    8.858321] w1_master_driver w1_bus_master1: Attaching one wire slave 01.000000000000 crc 3d
[    8.880136] w1_master_driver w1_bus_master1: Family 1 for 01.000000000000.3d is not registered.
[  OK  ] Started Network Time Synchronization.
[    9.464107] omap_wdt: OMAP Watchdog Timer Rev 0x01: initial timeout 60 sec
[    9.475788] vpe 489d0000.vpe: loading firmware vpdma-1b8.bin
[  OK  ] Started Network Service.
[    9.495236] net eth1: initializing cpsw version 1.15 (0)
[    9.516145] omap_i2c 4807c000.i2c: controller timed out
         Starting Wait for Network to be Configured...
[    9.531902] net eth1: phy "/ocp/ethernet@48484000/mdio@48485000/ethernet-phy@2" not found on slave 1
[    9.546139] pixcir_ts 4-005c: pixcir_set_power_mode: can't read reg 0x33 : -110
[    9.553483] pixcir_ts 4-005c: Failed to set IDLE mode
         Starting Network Name Resolution...
[    9.571488] pixcir_ts: probe of 4-005c failed with error -110
[    9.595541] IPv6: ADDRCONF(NETDEV_UP): eth1: link is not ready
[  OK  ] Reached target System Initialization.
[    9.606730] vpe 489d0000.vpe: Device registered as /dev/video0
[    9.619464] net eth0: initializing cpsw version 1.15 (0)
[  OK  ] Listening on Avahi mDNS/DNS-SD Stack Activation Socket.
[  OK  ] Listening on RPCbind Server Activation Socket.
[    9.693849] omap-sham 4b101000.sham: hw accel on OMAP rev 4.3
[    9.749255] Micrel KSZ9031 Gigabit PHY 48485000.mdio:01: attached PHY driver [Micrel KSZ9031 Gigabit PHY] (mii_bus:phy_addr=48485000.mdio:01, irq=POLL)
[    9.767753] IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
[    9.794598] omap-aes 4b500000.aes: OMAP AES hw accel rev: 3.3
[    9.820478] omap-aes 4b500000.aes: will run requests pump with realtime priority
[    9.853933] omap-aes 4b700000.aes: OMAP AES hw accel rev: 3.3
[    9.866704] omap-aes 4b700000.aes: will run requests pump with realtime priority
[  OK  ] Listening on D-Bus System Message Bus Socket.
[   10.171360] [drm] Initialized pvr 1.17.4948957 20110701 for 56000000.gpu on minor 1
[  OK  ] Listening on dropbear.socket.
[  OK  ] Reached target Sockets.
[  OK  ] Reached target Basic System.
[   10.312691] remoteproc remoteproc3: powering up 41000000.dsp
[   10.320208] remoteproc remoteproc3: Booting fw image dra7-dsp2-fw.xe66, size 20481364
[  OK  ] Started D-Bus System Message Bus.
[   10.339658] remoteproc remoteproc2: powering up 40800000.dsp
[   10.376229] remoteproc remoteproc2: Booting fw image dra7-dsp1-fw.xe66, size 20481364
         [   10.395321] omap-iommu 41501000.mmu: 41501000.mmu: version 3.0
Starting TI MultiCore Tools Daemon...
[   10.401873] omap-iommu 41502000.mmu: 41502000.mmu: version 3.0
[   10.419605] vip 48990000.vip: loading firmware vpdma-1b8.bin
[   10.428509] ahci 4a140000.sata: controller can't do 64bit DMA, forcing 32bit
         [   10.440036] omap-iommu 40d01000.mmu: 40d01000.mmu: version 3.0
Starting uim-sysfs.service...
[   10.446610] omap-iommu 40d02000.mmu: 40d02000.mmu: version 3.0
[   10.448807] ahci 4a140000.sata: forcing port_map 0x0 -> 0x1
[   10.472926] ahci 4a140000.sata: AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl platform mode
         Starting RPC Bind Service...
[   10.490349] asoc-simple-card sound0: tlv320aic3x-hifi <-> 48468000.mcasp mapping ok
[   10.506115] vip 48990000.vip: VPDMA firmware loaded
[   10.513024] ahci 4a140000.sata: flags: ncq sntf pm led clo only pmp pio slum part ccc apst
         Starting Print notice about GPLv3 packages...
[   10.547882] asoc-simple-card sound0: ASoC: no DMI vendor name!
[  OK  ] Started Periodic Command Scheduler.
         Starting TI IPC Daemon...
         Starting Reboot and dump vmcore via kexec...
[   10.639364] omap-rproc 41000000.dsp: mbox_request_channel failed: -517
         Starting Login Service...
[  OK  ] Started Job spooling tools.
[  OK  ] Started Daily Cleanup of Temporary Directories.
[  OK  ] Reached target System Time Synchronized.
[  OK  ] Started Daily rotation of log files.
[  OK  ] Reached target Timers.
[  OK  ] Started Network Name Resolution.
[   10.749381] remoteproc remoteproc3: can't start rproc 41000000.dsp: -16
[FAILED] Failed to start TI MultiCore Tools Daemon.
See 'systemctl status ti-mct-daemon.service' for details.
[  OK  ] Started RPC Bind Service.
[  OK  ] Started TI IPC Daemon.
[  OK  ] Started Reboot and dump vmcore via kexec.
[   10.941471] omap-rproc 40800000.dsp: mbox_request_channel failed: -517
[   10.956222] scsi host0: ahci
[   10.959443] ata1: SATA max UDMA/133 mmio [mem 0x4a140000-0x4a1410ff] port 0x100 irq 75
[   10.992419] remoteproc remoteproc2: can't start rproc 40800000.dsp: -16
[   11.327945] ata1: SATA link down (SStatus 0 SControl 300)
[  OK  ] Started uim-sysfs.service.
[   12.262622] dwc3 48890000.usb: Failed to get clk 'ref': -2
[   12.277829] OF: graph: no port node found in /ocp/ocp2scp@4a080000/phy@4a084000
[   12.286413] dwc3 48890000.usb: changing max_speed on rev 5533202a
[   12.293013] dwc3 488d0000.usb: Failed to get clk 'ref': -2
[   12.303339] OF: graph: no port node found in /ocp/ocp2scp@4a080000/phy@4a085000
[   12.419020] remoteproc remoteproc4: 4b234000.pru is available
[   12.428504] pru-rproc 4b234000.pru: PRU rproc node pru@4b234000 probed successfully
[   12.441422] remoteproc remoteproc5: 4b238000.pru is available
[   12.448289] pru-rproc 4b238000.pru: PRU rproc node pru@4b238000 probed successfully
[   12.468503] remoteproc remoteproc6: 4b2b4000.pru is available
[   12.474388] pru-rproc 4b2b4000.pru: PRU rproc node pru@4b2b4000 probed successfully
[   12.488731] remoteproc remoteproc7: 4b2b8000.pru is available
[   12.494604] pru-rproc 4b2b8000.pru: PRU rproc node pru@4b2b8000 probed successfully
***************************************************************
***************************************************************
NOTICE: This file system contains the following GPLv3 packages:
        autoconf
        bash-dev
        bash
        bc
        binutils-dev
        binutils
        bison-dev
        bison
        cifs-utils
        cpio
        cpp-symlinks
        cpp
        dosfstools
        elfutils-dev
        elfutils
        findutils
        g++-symlinks
        g++
        gawk
        gcc-symlinks
        gcc
        gdb
        gdbc6x
        gdbserver
        gettext
        glmark2
        gstreamer1.0-libav
        gzip
        hidapi
        libasm1
        libbfd
        libcairo-perf-utils
        libdw1
        libelf1
        libgdbm-compat4
        libgdbm-dev
        libgdbm6
        libgettextlib
        libgettextsrc
        libgmp10
        libidn2-0
        libmavconn
        libmpc3
        libmpfr6
        libreadline-dev
        libreadline7
        libunistring2
        m4-dev
        m4
        make
        mavlink
        mavros-extras
        mavros-msgs
        mavros
        nettle
        parted
        pdm-anomaly-detection
        socketcan-interface
        swig-dev
        swig
        which

If you do not wish to distribute GPLv3 components please remove
the above packages prior to distribution.  This can be done using
the opkg remove command.  i.e.:
    opkg remove <package>
Where <package> is the name printed in the list above

NOTE: If the package is a dependency of another package you
      will be notified of the dependent packages.  You should
      use the --force-removal-of-dependent-packages option to
      also remove the dependent packages as well
***************************************************************
***************************************************************
[  OK  ] Started Print notice about GPLv3 packages.
         Starting Save/Restore Sound Card State...
[  OK  ] Listening on Load/Save RF Kill Switch Status /dev/rfkill Watch.
[  OK  ] Created slice system-systemd\x2dfsck.slice.
         Starting File System Check on /dev/mmcblk0p1...
         Starting rc.pvr.service...
[  OK  ] Created slice system-systemd\x2dbacklight.slice.
         Starting Load/Save Screen Backlight…ightness of backlight:backlight...
         Starting Avahi mDNS/DNS-SD Stack...
[  OK  ] Reached target Network.
         Starting Lightning Fast Webserver With Light System Requirements...
[  OK  ] Started Redis In-Memory Data Store.
         Starting Simple Network Management Protocol (SNMP) Daemon....
         Starting Permit User Sessions...
         Starting Enable and configure wl18xx bluetooth stack...
[  OK  ] Reached target Host and Network Name Lookups.
[  OK  ] Started NFS status monitor for NFSv2/3 locking..
[  OK  ] Started Save/Restore Sound Card State.
[  OK  ] Started Load/Save Screen Backlight Brightness of backlight:backlight.
[  OK  ] Started Permit User Sessions.
[  OK  ] Started Getty on tty1.
[  OK  ] Started Serial Getty on ttyS2.
[  OK  ] Reached target Login Prompts.
         Starting Synchronize System and HW clocks...
[  OK  ] Reached target Sound Card.
[  OK  ] Started Login Service.
[  OK  ] Started Synchronize System and HW clocks.
[   15.609449] PVR_K: UM DDK-(4948957) and KM DDK-(4948957) match. [ OK ]
[  OK  ] Started rc.pvr.service.
         Starting weston.service...
[  OK  ] Started Avahi mDNS/DNS-SD Stack.
[  OK  ] Started Lightning Fast Webserver With Light System Requirements.
[  OK  ] Started weston.service.
         Starting Matrix GUI...
         Starting telnetd.service...
[  OK  ] Started telnetd.service.
         Starting thttpd.service...
[  OK  ] Started Matrix GUI.
[  OK  ] Started thttpd.service.
[  OK  ] Started File System Check on /dev/mmcblk0p1.
         Mounting /run/media/mmcblk0p1...
[  OK  ] Mounted /run/media/mmcblk0p1.
[  OK  ] Started Enable and configure wl18xx bluetooth stack.
[  OK  ] Started Simple Network Management Protocol (SNMP) Daemon..

 _____                    _____           _         _
|  _  |___ ___ ___ ___   |  _  |___ ___  |_|___ ___| |_
|     |  _| .'| . | . |  |   __|  _| . | | | -_|  _|  _|
|__|__|_| |__,|_  |___|  |__|  |_| |___|_| |___|___|_|
              |___|                    |___|

Arago Project http://arago-project.org am57xx-evm ttyS2

Arago 2019.07 am57xx-evm ttyS2

am57xx-evm login: root
^[[A^[[A^[[A^[[67;253Rroot@am57xx-evm:~# dmesg | grep vip
[   10.419232] vip 48990000.vip: sc_create
[   10.419243] vip 48990000.vip: csc_create
[   10.419574] vip 48990000.vip: sc_create
[   10.419583] vip 48990000.vip: csc_create
[   10.419592] vip 48990000.vip: vpdma_create
[   10.419605] vip 48990000.vip: loading firmware vpdma-1b8.bin
[   10.485177] vip 48990000.vip: firmware callback
[   10.506115] vip 48990000.vip: VPDMA firmware loaded
root@am57xx-evm:~# dmesg | grep vpe
[    9.463928] vpe 489d0000.vpe: vpe_runtime_get
[    9.474635] vpe 489d0000.vpe: VPE PID function f01
[    9.475753] vpe 489d0000.vpe: sc_create
[    9.475770] vpe 489d0000.vpe: csc_create
[    9.475779] vpe 489d0000.vpe: vpdma_create
[    9.475788] vpe 489d0000.vpe: loading firmware vpdma-1b8.bin
[    9.579010] vpe 489d0000.vpe: firmware callback
[    9.606730] vpe 489d0000.vpe: Device registered as /dev/video0
[   12.302156] vpe 489d0000.vpe: vpe_open
[   12.302190] vpe 489d0000.vpe: first instance created
[   12.302198] vpe 489d0000.vpe: created instance 6e03abcb, m2m_ctx: cb8e8df6
[   12.302460] vpe 489d0000.vpe: releasing instance 6e03abcb
[   12.302474] vpe 489d0000.vpe: last instance released
root@am57xx-evm:~# lsmod
Module                  Size  Used by
pru_rproc              20480  0
irq_pruss_intc         16384  1 pru_rproc
pruss                  16384  1 pru_rproc
dwc3                   73728  0
udc_core               28672  1 dwc3
ahci_platform          16384  0
ti_vip                 49152  0
libahci_platform       20480  1 ahci_platform
snd_soc_simple_card    16384  0
snd_soc_simple_card_utils    16384  1 snd_soc_simple_card
libahci                36864  2 ahci_platform,libahci_platform
pvrsrvkm              401408  4
omap_aes_driver        24576  0
libata                208896  3 ahci_platform,libahci_platform,libahci
pruss_soc_bus          16384  0
omap_sham              28672  0
phy_omap_usb2          16384  2
omap_wdt               16384  0
ti_vpe                 32768  0
ti_sc                  36864  2 ti_vpe,ti_vip
ti_csc                 16384  2 ti_vpe,ti_vip
ti_vpdma               24576  2 ti_vpe,ti_vip
omap_des               20480  0
snd_soc_tlv320aic3x    57344  1
des_generic            28672  1 omap_des
omap_hdq               16384  0
dwc3_omap              16384  0
rtc_omap               20480  1
wire                   32768  1 omap_hdq
at24                   20480  0
pixcir_i2c_ts          16384  0
crypto_engine          16384  2 omap_des,omap_aes_driver
omap_crypto            16384  2 omap_des,omap_aes_driver
omap_remoteproc        20480  0
virtio_rpmsg_bus       20480  0
remoteproc             49152  2 pru_rproc,omap_remoteproc
sch_fq_codel           20480  3
uio_module_drv         16384  0
uio                    20480  1 uio_module_drv
ftdi_sio               40960  0
usbserial              36864  1 ftdi_sio
usbcore               217088  2 ftdi_sio,usbserial
usb_common             16384  3 udc_core,usbcore,dwc3
jailhouse              32768  0
gdbserverproxy         16384  0
cryptodev              49152  0
root@am57xx-evm:~#

Not showing video1,

could you give me some suggestions

Thanking you,

Regards,

Ramachandra

  • Dear ti team,

    I am waiting for your response.

    If you need any further information about the problem, I can provide to you.

    Please look into this

    Regards

    Ramachandra

  • Hi Ramachandra,

    Apologies for delay in response

    without adding v4l2_subdev_init,v4l2_async_register_subdev but not showing the video1

    This could be because GS2971 is not able to map the endpoint. As I can see in the DTS entries you shared 

    remote-endpoint = <&vin3a>;

    remote-endpoint for GS2971 is not matching any valid endpoint name, as the actual endpoint name is vin3a_ep. Can you change remote-endpoint for GS2971 from vin3a to vin3a_ep and try (without adding v4l2_async_register_subdev and v4l2_subdev_init) if you can see video1

    Regards,
    Parth

  • Hi sir,

    Present dtb changed and removed v4l2_subdev_init & v4l2_async_register_subdev but not showing any video on the command prompt.

    Before loading gs2971 module i am loading v4l2_int_device.ko errors not getting but video not appearing the device list below dts file and gs2971 files added

    /* SEMTECH SD SDI reciever
     *
     * Copyright (C) 2014 RidgeRun
     * Author: Edison Fernández <edison.fernández@ridgerun.com>
     *
     * Currently working with 1080p30 and 720p60 with no audio support.
     * In order to support more standars the VD_STD value should be
     * used in order to identify the incomming resolution and framerate.
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     */
    
    /*!
     * @file gs2971.c
     *
     * @brief SEMTECH SD SDI reciever
     *
     * @ingroup Camera
     */
    
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/types.h>
    #include <linux/delay.h>
    #include <linux/device.h>
    #include <linux/i2c.h>
    #include <linux/of_gpio.h>
    #include <linux/videodev2.h>
    #include <linux/regulator/consumer.h>
    #include <linux/fsl_devices.h>
    #include <media/v4l2-chip-ident.h>
    //#include <media/v4l2-int-device.h>
    #include "v4l2-int-device.h"
    #include "mxc_v4l2_capture.h"
    #include <linux/proc_fs.h>
    
    #include <media/v4l2-async.h>
    #include <media/v4l2-device.h>
    #include <media/v4l2-common.h>
    #include <media/v4l2-mediabus.h>
    //#include <media/v4l2-of.h>
    #include <media/v4l2-ctrls.h>
    #include <media/media-entity.h>
    #include <linux/videodev2.h>
    
    #include <media/v4l2-ctrls.h>
    #include <media/v4l2-device.h>
    #include <media/v4l2-event.h>
    #include <media/v4l2-image-sizes.h>
    #include <media/v4l2-subdev.h>
    #include <media/v4l2-mediabus.h>
    #include <media/v4l2-common.h>
    //#include <media/v4l2-of.h>
    #include <media/v4l2-dv-timings.h>
    #include <media/v4l2-ioctl.h>
    
    #include "gs2971.h"
    
    #define DEBUG 1
    #define DRIVER_NAME     "gs2971"
    
    /* Debug functions */
    static int debug = 1;
    module_param(debug, int, 0644);
    MODULE_PARM_DESC(debug, "Debug level (0-2)");
    
    static struct gs2971_spidata *spidata;
    
    #define YUV_FORMAT(gs) ((gs->cea861) ? V4L2_PIX_FMT_UYVY : V4L2_PIX_FMT_YUYV)
    
    /*! @brief This mutex is used to provide mutual exclusion.
     *
     *  Create a mutex that can be used to provide mutually exclusive
     *  read/write access to the globally accessible data structures
     *  and variables that were defined above.
     */
    static DEFINE_MUTEX(mutex);
    
    int gs2971_read_buffer(struct spi_device *spi, u16 offset, u16 * values,
    		       int length)
    {
    	struct spi_message msg;
    	struct spi_transfer spi_xfer;
    	int status;
    	struct gs2971_spidata *sp = spidata;
    
    	if (!spi)
    		return -ENODEV;
    
    	if (length > GS2971_SPI_TRANSFER_MAX)
    		return -EINVAL;
    
    	sp->txbuf[0] = 0x8000 | (offset & 0xfff);	/* read */
    	if (length > 1)
    		sp->txbuf[0] |= 0x1000;	/* autoinc */
    
    	memset(&spi_xfer, '\0', sizeof(spi_xfer));
    	spi_xfer.tx_buf = sp->txbuf;
    	spi_xfer.rx_buf = sp->rxbuf;
    	spi_xfer.bits_per_word = 16;
    	spi_xfer.delay_usecs = 0;
    	spi_xfer.speed_hz = 1000000;
    	spi_xfer.len = sizeof(*values) * (length + 1);	// length in bytes
    
    	spi_message_init(&msg);
    	spi_message_add_tail(&spi_xfer, &msg);
    
    	status = spi_sync(spi, &msg);
    	
    	memcpy(values, &sp->rxbuf[1], sizeof(*values) * length);
    	if (status)
    		pr_err(">> Read buffer(%d) (%x): %x %x, %x %x\n", status,
    		       offset, sp->txbuf[0], sp->txbuf[1], sp->rxbuf[0],
    		       sp->rxbuf[1]);
    
    	return status;
    }
    
    int gs2971_read_register(struct spi_device *spi, u16 offset, u16 * value)
    {
    	struct spi_message msg;
    	struct spi_transfer spi_xfer;
    	int status;
    	u32 txbuf[1];
    	u32 rxbuf[1];
    
    	if (!spi)
    		return -ENODEV;
    
    	txbuf[0] = 0x80000000 | ((offset & 0xfff) << 16);	/* read */
    
    
    	memset(&spi_xfer, '\0', sizeof(spi_xfer));
    	spi_xfer.tx_buf = txbuf;
    	spi_xfer.rx_buf = rxbuf;
    	spi_xfer.bits_per_word = 32;	
    	spi_xfer.delay_usecs = 0;	
    	spi_xfer.speed_hz = 1000000;
    	spi_xfer.len = 4;	// length in bytes
    
    	spi_message_init(&msg);
    	spi_message_add_tail(&spi_xfer, &msg);
    
    	status = spi_sync(spi, &msg);
    
    	//dev_err(&spi->dev, "read_register status=%x\n", status);	//cispl
    	if (status) {
    		dev_dbg(&spi->dev, "read_reg failed\n");
    		*value = 0xffff;
    	} else {
    		*value = (u16) rxbuf[0];
    	}
    
    	if (status)
    		pr_err(">> Read register(%d) (%x): %x, %x\n", status, offset,
    		       txbuf[0], rxbuf[0]);
    
    	pr_debug("--> Read register (%x) with value: %x", offset, *value);
    	return status;
    }
    
    int gs2971_write_buffer(struct spi_device *spi, u16 offset, u16 * values,
    			int length)
    {
    	struct spi_message msg;
    	struct spi_transfer spi_xfer;
    	int status;
    	struct gs2971_spidata *sp = spidata;
    
    	if (!spi)
    		return -ENODEV;
    
    	if (length > GS2971_SPI_TRANSFER_MAX - 1)
    		return -EINVAL;
    
    	sp->txbuf[0] = (offset & 0xfff);	/* write  */
    	if (length > 1)
    		sp->txbuf[0] |= 0x1000;	/* autoinc */
    	memcpy(&sp->txbuf[1], values, sizeof(*values) * length);
    
    	memset(&spi_xfer, '\0', sizeof(spi_xfer));
    	spi_xfer.tx_buf = sp->txbuf;
    	spi_xfer.rx_buf = sp->rxbuf;
    	spi_xfer.bits_per_word = 16;
    	spi_xfer.delay_usecs = 0;
    	spi_xfer.speed_hz = 1000000;
    	spi_xfer.len = sizeof(*values) * (length + 1);	// length in bytes
    
    	spi_message_init(&msg);
    	spi_message_add_tail(&spi_xfer, &msg);
    
    	status = spi_sync(spi, &msg);
    	if (status)
    		pr_err(">> Write register(%d) (%x): %x %x, %x %x\n", status,
    		       offset, sp->txbuf[0], sp->txbuf[1], sp->rxbuf[0],
    		       sp->rxbuf[1]);
    	return status;
    }
    
    int gs2971_write_register(struct spi_device *spi, u16 offset, u16 value)
    {
    	pr_debug("--> Writing to address (%x) : %x\n", offset, value);
    	return gs2971_write_buffer(spi, offset, &value, 1);
    }
    const char *gpio_names[] = {
    [GPIO_STANDBY] = "standby-gpios",
    [GPIO_RESET] = "rst-gpios",
    [GPIO_TIM_861] = "tim_861-gpios",
    [GPIO_IOPROC_EN] = "ioproc_en-gpios",
    [GPIO_SW_EN] = "sw_en-gpios",
    [GPIO_RC_BYPASS] = "rc_bypass-gpios",
    [GPIO_AUDIO_EN] = "audio_en-gpios",
    [GPIO_DVB_ASI] = "dvb_asi-gpios",
    [GPIO_SMPTE_BYPASS] = "smpte_bypass-gpios",
    [GPIO_DVI_LOCK] = "dvi_lock-gpios",
    [GPIO_DATA_ERR] = "data_err-gpios",
    [GPIO_LB_CONT] = "lb_cont-gpios",
    [GPIO_Y_1ANC] = "y_1anc-gpios",
    };
    
    void gs2971_gpio_state(struct gs2971_priv *gs, int index, int active)
    {
    	if (gpio_is_valid(gs->gpios[index])) {
    		int state = (gs->gpio_flags[index] & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
    
    		state ^= active;
    		gpio_set_value(gs->gpios[index], state);
    		pr_info("%s: active=%d, %s(%d)=0x%x\n", __func__, active, gpio_names[index], gs->gpios[index], state);
    	}
    }
    
    static void gs2971_change_gpio_state(struct gs2971_priv *gs, int on)
    {
    	gs2971_gpio_state(gs, GPIO_STANDBY, on ? 0 : 1);
    	if (on) {
    		pr_debug("%s: power up delay\n", __func__);
    		msleep(1000);
    	}
    }
    
    static int gs2971_get_gpios(struct gs2971_priv *gs, struct device *dev)
    {
    	int i;
    	int ret;
    	enum of_gpio_flags flags;
    
    	for (i = 0; i < GPIO_CNT; i++) {
    		gs->gpios[i] = of_get_named_gpio_flags(dev->of_node, gpio_names[i], 0, &flags);
    		if (!gpio_is_valid(gs->gpios[i])) {
    			pr_info("%s: gpio %s not available\n", __func__, gpio_names[i]);
    		} else {
    			int gflags = (flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
    
    			if ((i == GPIO_STANDBY) || (i == GPIO_RESET))
    				gflags ^= GPIOF_INIT_HIGH;
    			if (flags == 2)
    				gflags = GPIOF_IN;
    
    			gs->gpio_flags[i] = flags;
    			pr_info("%s: %s flags(%d -> %d)\n", __func__, gpio_names[i], flags, gflags);
    			ret = devm_gpio_request_one(dev, gs->gpios[i], gflags, gpio_names[i]);
    			if (ret < 0) {
    				pr_info("%s: request of %s failed(%d)\n", __func__, gpio_names[i], ret);
    				return ret;
    			}
    		}
    	}
    	gs2971_gpio_state(gs, GPIO_IOPROC_EN, 1);	//active ioproc_en
    	msleep(2);
    	gs2971_gpio_state(gs, GPIO_RESET, 0);	//remove reset
    	msleep(400);
    	return 0;
    }
    
    static s32 power_control(struct gs2971_priv *gs, int on)
    {
    	struct sensor_data *sensor = &gs->sensor;
    	int i;
    	int ret = 0;
    
    	pr_debug("%s: %d\n", __func__, on);
    	if (sensor->on != on) {
    		if (on) {
    			for (i = 0; i < REGULATOR_CNT; i++) {
    				if (gs->regulator[i]) {
    					ret = regulator_enable(gs->regulator[i]);
    					if (ret) {
    						pr_err("%s:regulator_enable failed(%d)\n",
    							__func__, ret);
    						on = 0;	/* power all off */
    						break;
    					}
    				}
    			}
    		}
    		gs2971_change_gpio_state(gs, on);
    		sensor->on = on;
    		if (!on) {
    			for (i = REGULATOR_CNT - 1; i >= 0; i--) {
    				if (gs->regulator[i])
    					regulator_disable(gs->regulator[i]);
    			}
    		}
    	}
    	return ret;
    }
    
    static struct spi_device *gs2971_get_spi(struct gs2971_spidata *spidata)
    {
    	if (!spidata)
    		return NULL;
    	return spidata->spi;
    }
    
    static int get_std(struct v4l2_int_device *s, v4l2_std_id * id)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	struct spi_device *spi = NULL;
    	u16 std_lock_value;
    	u16 sync_lock_value;
    	u16 words_per_actline_value;
    	u16 words_per_line_value;
    	u16 lines_per_frame_value;
    	u16 actlines_per_frame_value;
    	u16 interlaced_flag;
    	int status;
    	u16 sd_audio_status_value;
    	u16 hd_audio_status_value;
    	u16 sd_audio_config_value;
    	u16 hd_audio_config_value;
    	u16 readback_value;
    	u16 ds1, ds2;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	gs->mode = gs2971_mode_not_supported;
    	gs->framerate = gs2971_default_fps;
    
    	spi = gs2971_get_spi(spidata);
    	if (!spi)
    		return -ENODEV;
    
    	*id = V4L2_STD_UNKNOWN;
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT4, &std_lock_value);
    	actlines_per_frame_value = std_lock_value & GS_RS4_ACTLINES_PER_FIELD;
    	interlaced_flag = std_lock_value & GS_RS4_INT_nPROG;
    
    	status =
    	    gs2971_read_register(spi, GS2971_FLYWHEEL_STATUS, &sync_lock_value);
    	if (status)
    		return status;
    	pr_debug("--> lock_value %x\n", sync_lock_value);
    	if (!sync_lock_value) {
    		pr_err("%s: no lock, gs2971\n", __func__);
    		return -EBUSY;
    	}
    
    	status = gs2971_read_register(spi, GS2971_DATA_FORMAT_DS1, &ds1);
    	if (status)
    		return status;
    	status = gs2971_read_register(spi, GS2971_DATA_FORMAT_DS2, &ds2);
    	if (status)
    		return status;
    	pr_debug("--> ds1=%x\n--> ds2=%x\n", ds1, ds2);
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT1,
    				 &words_per_actline_value);
    	if (status)
    		return status;
    	words_per_actline_value &= GS_RS1_WORDS_PER_ACTLINE;
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT2,
    				 &words_per_line_value);
    	if (status)
    		return status;
    	words_per_line_value &= GS_RS2_WORDS_PER_LINE;
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT3,
    				 &lines_per_frame_value);
    	if (status)
    		return status;
    	lines_per_frame_value &= GS_RS3_LINES_PER_FRAME;
    
    	pr_debug("--> Words per line %u/%u Lines per frame %u/%u\n",
    		 (unsigned int)words_per_actline_value,
    		 (unsigned int)words_per_line_value,
    		 (unsigned int)actlines_per_frame_value,
    		 (unsigned int)lines_per_frame_value);
    	pr_debug("--> SyncLock: %s %s StdLock: 0x%04x\n",
    		 (sync_lock_value & GS_FLY_V_LOCK_DS1) ? "Vsync" : "NoVsync",
    		 (sync_lock_value & GS_FLY_H_LOCK_DS1) ? "Hsync" : "NoHsync",
    		 (unsigned int)(std_lock_value));
    
    	status =
    	    gs2971_read_register(spi, GS2971_CH_VALID, &sd_audio_status_value);
    	if (status)
    		return status;
    
    	status =
    	    gs2971_read_register(spi, GS2971_HD_CH_VALID,
    				 &hd_audio_status_value);
    	if (status)
    		return status;
    
    	if (!lines_per_frame_value) {
    		pr_err("%s: 0 frame size\n", __func__);
    		return -EBUSY;
    	}
    
    	if (gs->cea861) {
    		sensor->spix.swidth = words_per_line_value - 1;
    		sensor->spix.sheight = lines_per_frame_value;
    	}
    	if (interlaced_flag && lines_per_frame_value == 525) {
    		pr_debug("--> V4L2_STD_525_60\n");
    		*id = V4L2_STD_525_60;
    	} else if (interlaced_flag && lines_per_frame_value == 625) {
    		pr_debug("--> V4L2_STD_625_50\n");
    		*id = V4L2_STD_625_50;
    	} else if (interlaced_flag && lines_per_frame_value == 525) {
    		pr_debug("--> V4L2_STD_525P_60\n");
    		*id = YUV_FORMAT(gs);
    	} else if (interlaced_flag && lines_per_frame_value == 625) {
    		pr_debug("--> V4L2_STD_625P_50\n");
    		*id = YUV_FORMAT(gs);
    	} else if (!interlaced_flag && 749 <= lines_per_frame_value
    		   && lines_per_frame_value <= 750) {
    		if (gs->cea861) {
    			sensor->spix.left = 220;
    			sensor->spix.top = 25;
    		}
    		sensor->pix.width = 1280;
    		sensor->pix.height = 720;
    		if (words_per_line_value > 1650) {
    			pr_debug("--> V4L2_STD_720P_50\n");
    			*id = YUV_FORMAT(gs);
    		} else {
    			pr_debug("--> V4L2_STD_720P_60\n");
    			gs->mode = gs2971_mode_720p;
    			gs->framerate = gs2971_60_fps;
    			*id = YUV_FORMAT(gs);
    		}
    	} else if (!interlaced_flag && 1124 <= lines_per_frame_value
    		   && lines_per_frame_value <= 1125) {
    		sensor->pix.width = 1920;
    		sensor->pix.height = 1080;
    		gs->mode = gs2971_mode_1080p;
    		gs->framerate = gs2971_30_fps;	// Currently only 1080p30 is supported
    
    		if (words_per_line_value >= 2200 + 550) {
    			pr_debug("--> V4L2_STD_1080P_24\n");
    			*id = YUV_FORMAT(gs);
    		} else if (words_per_line_value >= 2200 + 440) {
    			pr_debug("--> V4L2_STD_1080P_25\n");
    			*id = YUV_FORMAT(gs);
    		} else {
    			pr_debug("--> V4L2_STD_1080P_60\n");
    			*id = YUV_FORMAT(gs);
    		}
    	} else if (interlaced_flag && 1124 <= lines_per_frame_value
    		   && lines_per_frame_value <= 1125) {
    
    		sensor->pix.width = 1920;
    		sensor->pix.height = 1080;
    		if (words_per_line_value >= 2200 + 440) {
    			pr_debug("--> V4L2_STD_1080I_50\n");
    			*id = YUV_FORMAT(gs);
    		} else {
    			pr_debug("--> V4L2_STD_1080I_60\n");
    			*id = YUV_FORMAT(gs);
    		}
    	} else {
    		dev_err(&spi->dev,
    			"Std detection failed: interlaced_flag: %u words per line %u/%u Lines per frame %u/%u SyncLock: %s %s StdLock: 0x%04x\n",
    			(unsigned int)interlaced_flag,
    			(unsigned int)words_per_actline_value,
    			(unsigned int)words_per_line_value,
    			(unsigned int)actlines_per_frame_value,
    			(unsigned int)lines_per_frame_value,
    			(sync_lock_value & GS_FLY_V_LOCK_DS1) ? "Vsync" :
    			"NoVsync",
    			(sync_lock_value & GS_FLY_H_LOCK_DS1) ? "Hsync" :
    			"NoHsync", (unsigned int)(std_lock_value));
    		return -1;
    	}
    
    	sd_audio_config_value = 0xaaaa;	// 16-bit, right-justified
    
    	status =
    	    gs2971_write_register(spi, GS2971_CFG_AUD, sd_audio_config_value);
    	if (!status) {
    		status =
    		    gs2971_read_register(spi, GS2971_CFG_AUD, &readback_value);
    		if (!status) {
    			if (sd_audio_config_value != readback_value) {
    				dev_dbg(&spi->dev,
    					"SD audio readback failed, wanted x%04x, got x%04x\n",
    					(unsigned int)sd_audio_config_value,
    					(unsigned int)readback_value);
    			}
    		}
    	}
    
    	hd_audio_config_value = 0x0aa4;	// 16-bit, right-justified
    	status =
    	    gs2971_write_register(spi, GS2971_HD_CFG_AUD,
    				  hd_audio_config_value);
    	if (!status) {
    		status =
    		    gs2971_read_register(spi, GS2971_HD_CFG_AUD,
    					 &readback_value);
    		if (!status) {
    			if (hd_audio_config_value != readback_value) {
    				dev_dbg(&spi->dev,
    					"HD audio readback failed, wanted x%04x, got x%04x\n",
    					(unsigned int)hd_audio_config_value,
    					(unsigned int)readback_value);
    			}
    		}
    	}
    
    	status =
    	    gs2971_write_register(spi, GS2971_ANC_CONTROL, ANCCTL_ANC_DATA_DEL);
    	if (status)
    		return status;
    	pr_debug("--> remove anc data\n");
    
    #if 0
    	status = gs2971_write_register(spi, GS2971_ACGEN_CTRL,
    				       (GS2971_ACGEN_CTRL_SCLK_INV_MASK |
    					GS2971_ACGEN_CTRL_MCLK_SEL_128FS));
    #endif
    	return 0;
    }
    
    static void gs2971_workqueue_handler(struct work_struct *data);
    
    DECLARE_WORK(gs2971_worker, gs2971_workqueue_handler);
    
    static void gs2971_workqueue_handler(struct work_struct *ignored)
    {
    	struct spi_device *spi;
    	u16 bank_reg_base, anc_reg;
    	static u16 anc_buf[257];
    	int anc_length;
    	int adf_found = 1;
    	int ch_id;
    	int status;
    	u16 did, sdid;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	for (ch_id = 0; ch_id < GS2971_NUM_CHANNELS; ch_id++) {
    
    		spi = gs2971_get_spi(spidata);
    		if (!spi)
    			continue;
    
    		/* Step 2: start writing to other bank */
    		gs2971_write_register(spi, GS2971_ANC_CONTROL,
    				      ANCCTL_ANC_DATA_DEL |
    				      ANCCTL_ANC_DATA_SWITCH);
    
    #if 1
    		/* Step 1: read ancillary data */
    		bank_reg_base = GS2971_ANC_BANK_REG;
    		status = 0;
    		for (anc_reg = bank_reg_base, adf_found = 1; (0 == status) &&
    		     ((anc_reg + 6) < bank_reg_base + GS2971_ANC_BANK_SIZE);) {
    			status = gs2971_read_buffer(spi, anc_reg, anc_buf, 6);
    			anc_reg += 6;
    
    			if (anc_reg >= bank_reg_base + GS2971_ANC_BANK_SIZE)
    				break;
    
    			if (!status) {
    				if (anc_buf[0] == 0 ||
    				    anc_buf[1] == 0xff || anc_buf[2] == 0xff) {
    					did = anc_buf[3];
    					sdid = anc_buf[4];
    					anc_length = (anc_buf[5] & 0xff) + 1;
    					anc_reg += anc_length;
    
    					if (!(did == 0 && sdid == 0)
    					    && (did < 0xf8)) {
    						dev_dbg(&spi->dev,
    							"anc[%x] %02x %02x %02x\n",
    							anc_reg, did, sdid,
    							anc_length);
    					}
    				} else {
    					break;
    				}
    			}
    		}
    		dev_dbg(&spi->dev, "anc_end[%x] %02x %02x %02x\n",
    			anc_reg, anc_buf[0], anc_buf[1], anc_buf[2]);
    #endif
    
    		/* Step 3: switch reads to other bank */
    		gs2971_write_register(spi, GS2971_ANC_CONTROL,
    				      ANCCTL_ANC_DATA_DEL);
    	}
    }
    
    #if defined(GS2971_ENABLE_ANCILLARY_DATA)
    static int gs2971_init_ancillary(struct spi_device *spi)
    {
    	pr_debug("-> In function %s\n", __func__);
    
    	u16 value;
    	int offset;
    
    	int status = 0;
    
    	/* Set up ancillary data filtering */
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE1, 0x4100);
    	/*  SMPTE-352M Payload ID (0x4101) */
    	if (!status)
    		status = gs2971_write_register(spi, GS2971_REG_ANC_TYPE2, 0x5f00);	/* Placeholder */
    
    	if (!status)
    		status = gs2971_write_register(spi, GS2971_REG_ANC_TYPE3, 0x6000);	/* Placeholder */
    
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE4, 0x6100);
    	/* SMPTE 334 - SDID 01=EIA-708, 02=EIA-608 */
    
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE5, 0x6200);
    	/* SMPTE 334 - SDID 01=Program description, 02=Data broadcast, 03=VBI data */
    
    	if (0 == gs2971_read_register(spi, GS2971_REG_ANC_TYPE1, &value)) {
    		dev_dbg(&spi->dev, "REG_ANC_TYPE1 value x%04x\n",
    			(unsigned int)value);
    	}
    	if (0 == gs2971_read_register(spi, GS2971_REG_ANC_TYPE2, &value)) {
    		dev_dbg(&spi->dev, "REG_ANC_TYPE2 value x%04x\n",
    			(unsigned int)value);
    	}
    
    	/* Clear old ancillary data */
    	if (!status)
    		status = gs2971_write_register(spi, GS2971_ANC_CONTROL,
    					       ANCCTL_ANC_DATA_DEL |
    					       ANCCTL_ANC_DATA_SWITCH);
    
    	/* Step 2: start writing to other bank */
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_ANC_CONTROL,
    					  ANCCTL_ANC_DATA_DEL);
    	return status;
    }
    #endif
    
    /* gs2971_initialize :
     * This function will set the video format standard
     */
    static int gs2971_initialize(struct gs2971_priv *gs, struct spi_device *spi)
    {
    	int status = 0;
    	int retry = 0;
    	u16 value,i;
    	static u16 anc_buf[257];
    
    	static void __iomem *base;
    
    	//base = ioremap(0x4A009800, SZ_4K);	cispl
    	//__raw_writel(0x02,base);    		cispl
    
    //	u16 cfg = GS_VCFG1_861_PIN_DISABLE_MASK;
    	u16 cfg = 0xC0;
    	if (gs->cea861)		
    		cfg |= GS_VCFG1_TIMING_861_MASK;
    
    	pr_debug("-> In function %s\n", __func__);
    	for (;;) {
    		status = gs2971_write_register(spi, GS2971_VCFG1, cfg);
    
    		if (status)
    			return status;
    		status = gs2971_read_register(spi, GS2971_VCFG1, &value);
    
    		if (status)
    			return status;
    		dev_err(&spi->dev, "status=%x, read value of 0x%08x, expected 0x%08x\n", status,
    			(unsigned int)value, cfg);
    
    		if (value == cfg)
    			break;
    		if (retry++ >= 20)
    			return -ENODEV;
    		msleep(50);
    	}
    	
    //      status = gs2971_write_register(spi, GS2971_VCFG2, GS_VCFG2_DS_SWAP_3G);
    	status = gs2971_write_register(spi, GS2971_VCFG2, 0);
    	if (status)
    		return status;
    
    	status = gs2971_write_register(spi, GS2971_IO_CONFIG,
    				       (GS_IOCFG_HSYNC << 0) | (GS_IOCFG_VSYNC
    								<< 5) |
    				       (GS_IOCFG_DE << 10));
    	if (status)
    		return status;
    
    	status = gs2971_write_register(spi, GS2971_IO_CONFIG2,
    				       (GS_IOCFG_LOCKED << 0) | (GS_IOCFG_Y_ANC
    								 << 5) |
    				       (GS_IOCFG_DATA_ERROR << 10));
    	if (status)
    		return status;
    
    	status =
    	    gs2971_write_register(spi, GS2971_TIM_861_CFG, GS_TIMCFG_TRS_861);		
    	if (status)
    		return status;
    //	status =gs2971_write_register(spi, GS2971_RATE_SEL, 0x00);		//cispl
    	for(i=0;i<38;i++)
    	{
    		gs2971_read_register(spi, i, &value);
    		dev_err(&spi->dev, "register %02x = %08x\n",i,(unsigned int)value);
    	}
    #if defined(GS2971_ENABLE_ANCILLARY_DATA)
    	gs2971_init_ancillary(spi);
    #endif
    
    #if 0
    	if (gs2971_timer.function == NULL) {
    		init_timer(&gs2971_timer);
    		gs2971_timer.function = gs2971_timer_function;
    	}
    	mod_timer(&gs2971_timer, jiffies + msecs_to_jiffies(gs2971_timeout_ms));
    #endif
    	return status;
    }
    
    #if 0
    /*!
     * Return attributes of current video standard.
     * Since this device autodetects the current standard, this function also
     * sets the values that need to be changed if the standard changes.
     * There is no set std equivalent function.
     *
     *  @return		None.
     */
    static void gs2971_get_std(struct v4l2_int_device *s, v4l2_std_id * std)
    {
    	pr_debug("-> In function %s\n", __func__);
    }
    #endif
    
    /***********************************************************************
     * IOCTL Functions from v4l2_int_ioctl_desc.
     ***********************************************************************/
    
    /*!
     * ioctl_g_ifparm - V4L2 sensor interface handler for vidioc_int_g_ifparm_num
     * s: pointer to standard V4L2 device structure
     * p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure
     *
     * Gets slave interface parameters.
     * Calculates the required xclk value to support the requested
     * clock parameters in p.  This value is returned in the p
     * parameter.
     *
     * vidioc_int_g_ifparm returns platform-specific information about the
     * interface settings used by the sensor.
     *
     * Called on open.
     */
    static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	/* Initialize structure to 0s then set any non-0 values. */
    	memset(p, 0, sizeof(*p));
    	p->u.bt656.clock_curr = sensor->mclk;
    	if (gs->cea861) {
    		p->if_type = V4L2_IF_TYPE_BT656;	/* This is the only possibility. */
    		p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT;
    		p->u.bt656.bt_sync_correct = 1;
    //      	p->u.bt656.nobt_vs_inv = 1;
    		p->u.bt656.nobt_hs_inv = 1;
    	} else {
    		/*
    		 * p->if_type = V4L2_IF_TYPE_BT656_PROGRESSIVE;
    		 * BT.656 - 20/10bit pin low doesn't work because then EAV of
    		 * DS1/2 are also interleaved and imx only recognizes 4 word
    		 * EAV/SAV codes, not 8
    		 */
    		p->if_type = V4L2_IF_TYPE_BT1120_PROGRESSIVE_SDR;
    		p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_BT_10BIT;
    		p->u.bt656.bt_sync_correct = 0;	// Use embedded sync
    		p->u.bt656.nobt_vs_inv = 1;
    //		p->u.bt656.nobt_hs_inv = 1;
    	}
    	p->u.bt656.latch_clk_inv = 0;	/* pixel clk polarity */
    	p->u.bt656.clock_min = 6000000;
    	p->u.bt656.clock_max = 180000000;
    	return 0;
    }
    
    static int ioctl_s_power(struct v4l2_int_device *s, int on)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	if (on && !sensor->on) {
    		power_control(gs, 1);
    	} else if (!on && sensor->on) {
    		power_control(gs, 0);
    	}
    	return 0;
    }
    
    /*!
     * ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl
     * @s: pointer to standard V4L2 device structure
     * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure
     *
     * Returns the sensor's video CAPTURE parameters.
     */
    static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	struct v4l2_captureparm *cparm = &a->parm.capture;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	switch (a->type) {
    		/* These are all the possible cases. */
    	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
    		pr_debug("   type is V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
    		memset(a, 0, sizeof(*a));
    		a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		cparm->capability = sensor->streamcap.capability;
    		cparm->timeperframe = sensor->streamcap.timeperframe;
    		cparm->capturemode = sensor->streamcap.capturemode;
    		break;
    
    	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
    	case V4L2_BUF_TYPE_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_VBI_OUTPUT:
    	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
    		break;
    
    	default:
    		pr_debug("ioctl_g_parm:type is unknown %d\n", a->type);
    		break;
    	}
    	return 0;
    }
    
    /*!
     * ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl
     * @s: pointer to standard V4L2 device structure
     * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure
     *
     * Configures the sensor to use the input parameters, if possible.  If
     * not possible, reverts to the old parameters and returns the
     * appropriate error code.
     *
     * This driver cannot change these settings.
     */
    static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
    	int ret = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	/* Make sure power on */
    	power_control(gs, 1);
    
    	switch (a->type) {
    		/* This is the only case currently handled. */
    	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
    		/* Check that the new frame rate is allowed. */
    		if ((timeperframe->numerator == 0) ||
    		    (timeperframe->denominator == 0)) {
    			timeperframe->denominator =
    			    gs2971_framerates[gs2971_default_fps];
    			timeperframe->numerator = 1;
    			pr_warning("   Setting framerate to default (%dfps)!\n",
    				   gs2971_framerates[gs2971_default_fps]);
    		} else if (timeperframe->denominator !=
    			   gs2971_framerates[gs->framerate]) {
    			pr_warning
    			    ("   Input framerate is %dfps and you are trying to set %dfps!\n",
    			     gs2971_framerates[gs->framerate],
    			     timeperframe->denominator);
    		}
    		sensor->streamcap.timeperframe = *timeperframe;
    		sensor->streamcap.capturemode =
    		    (u32) a->parm.capture.capturemode;
    		break;
    
    		/* These are all the possible cases. */
    	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
    	case V4L2_BUF_TYPE_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_VBI_OUTPUT:
    	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
    		pr_debug("   type is not V4L2_BUF_TYPE_VIDEO_CAPTURE but %d\n",
    			 a->type);
    		ret = -EINVAL;
    		break;
    
    	default:
    		pr_debug("   type is unknown - %d\n", a->type);
    		ret = -EINVAL;
    		break;
    	}
    	return ret;
    }
    
    /*!
     * ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap
     * @s: pointer to standard V4L2 device structure
     * @f: pointer to standard V4L2 v4l2_format structure
     *
     * Returns the sensor's current pixel format in the v4l2_format
     * parameter.
     */
    static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	v4l2_std_id std = V4L2_STD_UNKNOWN;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	power_control(gs, 1);
    	switch (f->type) {
    	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
    		get_std(s, &std);
    		f->fmt.pix = sensor->pix;
    		break;
    
    	case V4L2_BUF_TYPE_SENSOR:
    		pr_debug("%s: left=%d, top=%d, %dx%d\n", __func__,
    			sensor->spix.left, sensor->spix.top,
    			sensor->spix.swidth, sensor->spix.sheight);
    		f->fmt.spix = sensor->spix;
    		break;
    
    	case V4L2_BUF_TYPE_PRIVATE:
    		get_std(s, &std);
    //              f->fmt.pix.pixelformat = (u32)std;
    		break;
    
    	default:
    		f->fmt.pix = sensor->pix;
    		break;
    	}
    	return 0;
    }
    
    /*!
     * ioctl_queryctrl - V4L2 sensor interface handler for VIDIOC_QUERYCTRL ioctl
     * @s: pointer to standard V4L2 device structure
     * @qc: standard V4L2 VIDIOC_QUERYCTRL ioctl structure
     *
     * If the requested control is supported, returns the control information
     * from the video_control[] array.  Otherwise, returns -EINVAL if the
     * control is not supported.
     */
    static int ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qc)
    {
    	pr_debug("-> In function %s\n", __func__);
    	return -EINVAL;
    }
    
    /*!
     * ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl
     * @s: pointer to standard V4L2 device structure
     * @vc: standard V4L2 VIDIOC_G_CTRL ioctl structure
     *
     * If the requested control is supported, returns the control's current
     * value from the video_control[] array.  Otherwise, returns -EINVAL
     * if the control is not supported.
     */
    static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	int ret = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	switch (vc->id) {
    	case V4L2_CID_BRIGHTNESS:
    		vc->value = sensor->brightness;
    		break;
    	case V4L2_CID_HUE:
    		vc->value = sensor->hue;
    		break;
    	case V4L2_CID_CONTRAST:
    		vc->value = sensor->contrast;
    		break;
    	case V4L2_CID_SATURATION:
    		vc->value = sensor->saturation;
    		break;
    	case V4L2_CID_RED_BALANCE:
    		vc->value = sensor->red;
    		break;
    	case V4L2_CID_BLUE_BALANCE:
    		vc->value = sensor->blue;
    		break;
    	case V4L2_CID_EXPOSURE:
    		vc->value = sensor->ae_mode;
    		break;
    	default:
    		ret = -EINVAL;
    	}
    	return ret;
    }
    
    /*!
     * ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl
     * @s: pointer to standard V4L2 device structure
     * @vc: standard V4L2 VIDIOC_S_CTRL ioctl structure
     *
     * If the requested control is supported, sets the control's current
     * value in HW (and updates the video_control[] array).  Otherwise,
     * returns -EINVAL if the control is not supported.
     */
    static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
    {
    	struct gs2971_priv *gs = s->priv;
    //	struct sensor_data *sensor = &gs->sensor;
    	int retval = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	///* Make sure power on */
    	power_control(gs, 1);
    
    	switch (vc->id) {
    	case V4L2_CID_BRIGHTNESS:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_BRIGHTNESS\n");
    		break;
    	case V4L2_CID_CONTRAST:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_CONTRAST\n");
    		break;
    	case V4L2_CID_SATURATION:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_SATURATION\n");
    		break;
    	case V4L2_CID_HUE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_HUE\n");
    		break;
    	case V4L2_CID_AUTO_WHITE_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_AUTO_WHITE_BALANCE\n");
    		break;
    	case V4L2_CID_DO_WHITE_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_DO_WHITE_BALANCE\n");
    		break;
    	case V4L2_CID_RED_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_RED_BALANCE\n");
    		break;
    	case V4L2_CID_BLUE_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_BLUE_BALANCE\n");
    		break;
    	case V4L2_CID_GAMMA:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_GAMMA\n");
    		break;
    	case V4L2_CID_EXPOSURE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_EXPOSURE\n");
    		break;
    	case V4L2_CID_AUTOGAIN:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_AUTOGAIN\n");
    		break;
    	case V4L2_CID_GAIN:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_GAIN\n");
    		break;
    	case V4L2_CID_HFLIP:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_HFLIP\n");
    		break;
    	case V4L2_CID_VFLIP:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_VFLIP\n");
    		break;
    	default:
    		dev_dbg(&spidata->spi->dev, "   Default case\n");
    		retval = -EPERM;
    		break;
    	}
    	return retval;
    }
    
    /*!
     * ioctl_enum_framesizes - V4L2 sensor interface handler for
     *			   VIDIOC_ENUM_FRAMESIZES ioctl
     * @s: pointer to standard V4L2 device structure
     * @fsize: standard V4L2 VIDIOC_ENUM_FRAMESIZES ioctl structure
     *
     * Return 0 if successful, otherwise -EINVAL.
     */
    static int ioctl_enum_framesizes(struct v4l2_int_device *s,
    				 struct v4l2_frmsizeenum *fsize)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	if (fsize->index > gs2971_mode_MAX || gs->mode > gs2971_mode_MAX)
    		return -EINVAL;
    
    	fsize->pixel_format = sensor->pix.pixelformat;
    	fsize->discrete.width = gs2971_res[gs->mode].width;
    	fsize->discrete.height = gs2971_res[gs->mode].height;
    	return 0;
    }
    
    /*!
     * ioctl_g_chip_ident - V4L2 sensor interface handler for
     *			VIDIOC_DBG_G_CHIP_IDENT ioctl
     * @s: pointer to standard V4L2 device structure
     * @id: pointer to int
     *
     * Return 0.
     */
    static int ioctl_g_chip_ident(struct v4l2_int_device *s, int *id)
    {
    	pr_debug("-> In function %s\n", __func__);
    
    	((struct v4l2_dbg_chip_ident *)id)->match.type =
    	    V4L2_CHIP_MATCH_I2C_DRIVER;
    	strcpy(((struct v4l2_dbg_chip_ident *)id)->match.name, "gs2971_video");
    
    	return 0;
    }
    
    /*!
     * ioctl_enum_fmt_cap - V4L2 sensor interface handler for VIDIOC_ENUM_FMT
     * @s: pointer to standard V4L2 device structure
     * @fmt: pointer to standard V4L2 fmt description structure
     *
     * Return 0.
     */
    static int ioctl_enum_fmt_cap(struct v4l2_int_device *s,
    			      struct v4l2_fmtdesc *fmt)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	if (fmt->index > 0)
    		return -EINVAL;
    	fmt->pixelformat = sensor->pix.pixelformat;	//gs->pix.pixelformat;
    	return 0;
    }
    
    /*!
     * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT
     * @s: pointer to standard V4L2 device structure
     */
    static int ioctl_init(struct v4l2_int_device *s)
    {
    	pr_debug("-> In function %s\n", __func__);
    	return 0;
    }
    
    /*!
     * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num
     * @s: pointer to standard V4L2 device structure
     *
     * Initialise the device when slave attaches to the master.
     */
    static int ioctl_dev_init(struct v4l2_int_device *s)
    {
    	pr_debug("-> In function %s\n", __func__);
    	return 0;
    }
    
    /*!
     * This structure defines all the ioctls for this module.
     */
    static struct v4l2_int_ioctl_desc gs2971_ioctl_desc[] = {
    
    	{vidioc_int_dev_init_num, (v4l2_int_ioctl_func *) ioctl_dev_init},
    	{vidioc_int_s_power_num, (v4l2_int_ioctl_func *) ioctl_s_power},
    	{vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func *) ioctl_g_ifparm},
    	{vidioc_int_init_num, (v4l2_int_ioctl_func *) ioctl_init},
    
    	/*!
    	 * VIDIOC_ENUM_FMT ioctl for the CAPTURE buffer type.
    	 */
    	{vidioc_int_enum_fmt_cap_num,
    	 (v4l2_int_ioctl_func *) ioctl_enum_fmt_cap},
    	{vidioc_int_g_fmt_cap_num, (v4l2_int_ioctl_func *) ioctl_g_fmt_cap},
    	{vidioc_int_g_parm_num, (v4l2_int_ioctl_func *) ioctl_g_parm},
    	{vidioc_int_s_parm_num, (v4l2_int_ioctl_func *) ioctl_s_parm},
    	{vidioc_int_queryctrl_num, (v4l2_int_ioctl_func *) ioctl_queryctrl},
    	{vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func *) ioctl_g_ctrl},
    	{vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl},
    	{vidioc_int_enum_framesizes_num,
    	 (v4l2_int_ioctl_func *) ioctl_enum_framesizes},
    	{vidioc_int_g_chip_ident_num,
    	 (v4l2_int_ioctl_func *) ioctl_g_chip_ident},
    };
    
    static struct v4l2_int_slave gs2971_slave = {
    	.ioctls = gs2971_ioctl_desc,
    	.num_ioctls = ARRAY_SIZE(gs2971_ioctl_desc),
    };
    
    static struct v4l2_int_device gs2971_int_device = {
    	.module = THIS_MODULE,
    	.name = "gs2971",
    	.type = v4l2_int_type_slave,
    	.u = {
    	      .slave = &gs2971_slave,
    	      },
    };
    static int gs_g_register(struct v4l2_subdev *sd,
    		  struct v4l2_dbg_register *reg)
    {
    	struct spi_device *spi = v4l2_get_subdevdata(sd);
    	u16 val;
    	int ret;
    
    	ret = gs2971_read_register(spi, reg->reg & 0xFFFF, &val);
    	reg->val = val;
    	reg->size = 2;
    	return ret;
    }
    static int gs_s_register(struct v4l2_subdev *sd,
    		  const struct v4l2_dbg_register *reg)
    {
    	struct spi_device *spi = v4l2_get_subdevdata(sd);
    
    	return gs2971_write_register(spi, reg->reg & 0xFFFF, reg->val & 0xFFFF);
    
    }
    /*static inline struct gs2971_spidata *to_gs(struct v4l2_subdev *sd)
    {
    	return container_of(sd, struct gs2971_spidata, sd);
    }
    static int gs_s_dv_timings(struct v4l2_subdev *sd,
    		    struct v4l2_dv_timings *timings)
    {
    	struct gs2971_spidata *gs = to_gs(sd);
    	int reg_value;
    
    	reg_value = get_register_timings(timings);
    	if (reg_value == 0x0)
    		return -EINVAL;
    
    	gs->current_timings = *timings;
    	return 0;
    }
    static int gs_g_dv_timings(struct v4l2_subdev *sd,
    		    struct v4l2_dv_timings *timings)
    {
    	struct gs *gs = to_gs(sd);
    
    	*timings = gs->current_timings;
    	return 0;
    }
    static int gs_g_input_status(struct v4l2_subdev *sd, u32 *status)
    {
    	struct gs2971_spidata *gs = to_gs(sd);
    	u16 reg_value, i;
    	int ret;
    */
    	/*
    	 * Check if the component detect a line, a frame or something else
    	 * which looks like a video signal activity.
    	 */
    /*	for (i = 0; i < 4; i++) {
    		ret = gs2971_read_register(gs->pdev,
    				       REG_LINES_PER_FRAME + i, &reg_value);
    		if (reg_value)
    			break;
    		if (ret) {
    			*status = V4L2_IN_ST_NO_POWER;
    			return ret;
    		}
    	}
    */
    	/* If no register reports a video signal */
    /*	if (i >= 4)
    		*status |= V4L2_IN_ST_NO_SIGNAL;
    
    	ret = gs_read_register(gs->pdev, REG_STATUS, &reg_value);
    	if (!(reg_value & MASK_H_LOCK))
    		*status |=  V4L2_IN_ST_NO_H_LOCK;
    	if (!(reg_value & MASK_V_LOCK))
    		*status |=  V4L2_IN_ST_NO_V_LOCK;
    	if (!(reg_value & MASK_STD_LOCK))
    		*status |=  V4L2_IN_ST_NO_STD_LOCK;
    
    	return ret;
    }
    static int gs_query_dv_timings(struct v4l2_subdev *sd,
    			struct v4l2_dv_timings *timings)
    {
    	struct gs *gs = to_gs(sd);
    	struct v4l2_dv_timings fmt;
    	u16 reg_value, i;
    	int ret;
    
    	if (gs->enabled)
    		return -EBUSY;
    */
    	/*
    	 * Check if the component detect a line, a frame or something else
    	 * which looks like a video signal activity.
    	 */
    /*	for (i = 0; i < 4; i++) {
    		gs_read_register(gs->pdev, REG_LINES_PER_FRAME + i, &reg_value);
    		if (reg_value)
    			break;
    	}
    */
    	/* If no register reports a video signal */
    /*	if (i >= 4)
    		return -ENOLINK;
    
    	gs_read_register(gs->pdev, REG_STATUS, &reg_value);
    	if (!(reg_value & MASK_H_LOCK) || !(reg_value & MASK_V_LOCK))
    		return -ENOLCK;
    	if (!(reg_value & MASK_STD_LOCK))
    		return -ERANGE;
    
    	ret = gs_status_format(reg_value, &fmt);
    
    	if (ret < 0)
    		return ret;
    
    	*timings = fmt;
    	return 0;
    }
    static int gs_s_stream(struct v4l2_subdev *sd, int enable)
    {
    	struct gs *gs = to_gs(sd);
    	int reg_value;
    
    	if (gs->enabled == enable)
    		return 0;
    
    	gs->enabled = enable;
    
    	if (enable) {
    */		/* To force the specific format */
    //		reg_value = get_register_timings(&gs->current_timings);
    //		return gs_write_register(gs->pdev, REG_FORCE_FMT, reg_value);
    //	}
    
    	/* To renable auto-detection mode */
    //	return gs_write_register(gs->pdev, REG_FORCE_FMT, 0x0);
    //}
    
    static const struct v4l2_subdev_core_ops gs2971_core_ops = {
    #ifdef CONFIG_VIDEO_ADV_DEBUG
    	.g_register = gs_g_register,
    	.s_register = gs_s_register,
    #endif
    };
    
    static const struct v4l2_subdev_video_ops gs2971_video_ops = {
    //	.g_std = get_std,
    //	.g_fmt_cap = ioctl_g_fmt_cap,
    //	.g_parm = ioctl_g_parm,
    //	.s_parm = ioctl_s_parm,
    //	.queryctrl = ioctl_queryctrl,
    //	.enum_framesizes = ioctl_enum_framesizes,
    };
    
    static const struct v4l2_subdev_pad_ops gs2971_pad_ops = {
    //	.enum_dv_timings = ioctl_dev_init,
    //	.dv_timings_cap = ioctl_init,
    };
    static const struct v4l2_subdev_ops gs2971_ops = {
    	.core = &gs2971_core_ops,
    	.video = &gs2971_video_ops,
    	.pad = &gs2971_pad_ops,
    };
    
    /*!
     * GS2971 SPI probe function.
     * Function set in spi_driver struct.
     * Called by insmod.
     *
     *  @param *spi	SPI device descriptor.
     *
     *  @return		Error code indicating success or failure.
     */
    static int gs2971_probe(struct spi_device *spi)
    {
    	struct v4l2_subdev *sd;
    	struct device *dev = &spi->dev;
    	struct gs2971_priv *gs;
    	struct sensor_data *sensor;
    	struct pinctrl_state *pins;
    
    	int ret = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	gs = kzalloc(sizeof(*gs), GFP_KERNEL);
    	if (!gs)
    			return -ENOMEM;
    
    	/* Allocate driver data */
    	spidata = kzalloc(sizeof(*spidata), GFP_KERNEL);
    	if (!spidata) {
    		ret = -ENOMEM;
    		goto exit;
    	}
    	/* Initialize the driver data */
    	spidata->spi = spi;
    	mutex_init(&spidata->buf_lock);
    	sensor = &gs->sensor;
    
    	/* Set initial values for the sensor struct. */
    	memset(gs, 0, sizeof(*gs));
    	ret = of_property_read_u32(dev->of_node, "mclk", &sensor->mclk);
    	dev_err(dev, "mclk=%x\n",sensor->mclk);
    	if (ret) {
    		dev_err(dev, "mclk missing or invalid\n");
    		goto exit;
    	}
    
    	ret = of_property_read_u32(dev->of_node, "ipu", &sensor->ipu_id);
    	dev_err(dev, "ipu=%x\n",sensor->ipu_id);
    	if (ret) {
    		dev_err(dev, "ipu missing or invalid\n");
    		goto exit;
    	}
    
    	ret = of_property_read_u32(dev->of_node, "csi", &sensor->csi);
    	if (ret) {
    		dev_err(dev, "csi missing or invalid\n");
    		goto exit;
    	}
    
    	ret = of_property_read_u32(dev->of_node, "cea861", &gs->cea861);
    	if (ret) {
    		dev_err(dev, "cea861 missing or invalid\n");
    		goto exit;
    	}
    	pr_info("%s:cea861=%d\n", __func__, gs->cea861);
    
    	/*gs->pinctrl = devm_pinctrl_get(dev);
    	if (IS_ERR(gs->pinctrl)) {
    		ret = PTR_ERR(gs->pinctrl);
    		dev_err(dev, "pinctrl missing or invalid\n");
    		goto exit;
    	}
    
    
    	pins = pinctrl_lookup_state(gs->pinctrl, gs->cea861 ? "cea861" : "no_cea861");
    	if (IS_ERR(pins)) {
    		ret = PTR_ERR(pins);
    		dev_err(dev, "pinctrl lookup state missing or invalid\n");
    		goto exit;
    	}
    
    	ret = pinctrl_select_state(gs->pinctrl, pins);
    	if (ret)
    	{
    		dev_err(dev, "pinctrl select state missing or invalid\n");
    		goto exit;
    	}*/
    	sensor->pix.pixelformat = YUV_FORMAT(gs);
    	sensor->pix.width = gs2971_res[gs2971_mode_default].width;
    	sensor->pix.height = gs2971_res[gs2971_mode_default].height;
    	sensor->streamcap.capability = V4L2_MODE_HIGHQUALITY |
    	    V4L2_CAP_TIMEPERFRAME;
    	sensor->streamcap.capturemode = 0;
    	sensor->streamcap.timeperframe.denominator = DEFAULT_FPS;
    	sensor->streamcap.timeperframe.numerator = 1;
    
    	//sensor->pix.priv = 1;  /* 1 is used to indicate TV in */
    	/*ret = gs2971_get_gpios(gs, dev);
    	if (ret)
    	{
    		dev_err(dev, "get gpio missing or invalid\n");	
    		goto exit;
    	}*/
    	power_control(gs, 1);
    	gs2971_int_device.priv = gs;
    
    	ret = gs2971_initialize(gs, spi);
    	if (ret)
    	{	
    		dev_err(dev, "gs2971 init missing or invalid\n");	
    		goto exit;
    	}
    	power_control(gs, 0);
    
    	spidata->spi = spi;
    	sd = &spidata->sd;
    	ret = v4l2_int_device_register(&gs2971_int_device);
    	//v4l2_device_register(&spi->dev, &spi->sd);
    	//v4l2_spi_subdev_init(sd, spi, &gs2971_ops);		
    	//v4l2_subdev_init(sd, &gs2971_ops);
    	//ret = v4l2_async_register_subdev(sd);
     exit:
    	if (ret) {
    		kfree(spidata);
    		kfree(gs);
    		pr_err("gs2971_probe returns %d\n", ret);
    	}
    	return ret;
    
    }
    
    static int gs2971_remove(struct spi_device *spi)
    {
    	struct v4l2_subdev *sd;
    	pr_debug("-> In function %s\n", __func__);
    	kfree(gs2971_int_device.priv);
    	kfree(spidata);
    	v4l2_int_device_unregister(&gs2971_int_device);
    	//v4l2_device_unregister_subdev(sd);
    	//v4l2_async_unregister_subdev(sd);
    	return 0;
    }
    
    static const struct of_device_id gs2971_dt_ids[] = {
    	{
    		.compatible = "gn,gs2971",
    	}, {
    		/* sentinel */
    	}
    };
    MODULE_DEVICE_TABLE(of, gs2971_dt_ids);
    
    static struct spi_driver gs2971_spi = {
    	.driver = {
    		   .name = DRIVER_NAME,
    		   .bus = &spi_bus_type,
    		   .owner = THIS_MODULE,
    		   .of_match_table = gs2971_dt_ids,
    		   },
    	.probe = gs2971_probe,
    	.remove = gs2971_remove,
    };
    
    /*!
     * gs2971 init function.
     * Called on insmod.
     *
     * @return    Error code indicating success or failure.
     */
    static int __init gs2971_init(void)
    {
    	int ret;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	ret = spi_register_driver(&gs2971_spi);
    
    	return ret;
    }
    
    /*!
     * gs2971 cleanup function.
     * Called on rmmod.
     *
     * @return   Error code indicating success or failure.
     */
    static void __exit gs2971_exit(void)
    {
    	pr_debug("-> In function %s\n", __func__);
    
    	spi_unregister_driver(&gs2971_spi);
    }
    
    module_init(gs2971_init);
    module_exit(gs2971_exit);
    MODULE_DESCRIPTION("gs2971 video input Driver");
    MODULE_LICENSE("GPL");
    MODULE_VERSION("1.0");
    MODULE_ALIAS("CSI");

    /* DTS FILE*/

    &vip2{
        status="okay";
    };
    
    &vin3a {
        status="okay";
        vin3a_ep: endpoint {
            remote-endpoint = <&gs2971_cam0>;
            slave-mode;
        };
    };
    
    &mcspi3{
        status="okay";
        pinctrl-names = "default";
    //    pinctrl-0 = <&spi3_pins_default>;
        ti,pindir-d0-out-d1-in;
        bus-num=<3>;   
        
        gs2971: gs2971@2 {
            compatible = "gn,gs2971";
            reg = <2>;
            bits_per_word=<16>;
            mclk = <27000000>;
            csi = <1>;
            cea861 = <0>;
            ipu = <1>;
            spi-max-frequency = <6000000>;
            //port {
            //#address-cells = <1>;
            //#size-cells = <0>;
            port {        
                gs2971_cam0: endpoint {
                remote-endpoint = <&vin3a_ep>;
                hsync-active = <1>;
                vsync-active = <1>;
                pixel-clock-freq = <74250000>;    //750khZ
                        //input-clock-freq = <74250000>;
                pclk-sample = <0>;
                    data-shift = <0>;
                bus-width = <16>;    
                };
            };
        };
    };


    But it's not showing any video i am attaching the prompt


    am57xx-evm login: root
    root@am57xx-evm:~# cd ..
    root@am57xx-evm:/home# cd ..
    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/
    common/ i2c/ platform/ usb/ v4l2-core/
    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/v4l2-core/v4l2-fwnode.ko
    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/platform/mxc/capture/v4l2-int-device.ko
    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/platform/mxc/capture/gs2971_video.ko
    [ 48.252890] gs2971 spi3.2: mclk=19bfcc0
    [ 48.256979] gs2971 spi3.2: ipu=1
    [ 48.260477] gs2971_probe:cea861=0
    [ 48.265692] gs2971_gpio_state: active=0, standby-gpios(0)=0x0
    [ 49.352544] gs2971 spi3.2: status=0, read value of 0x000000c0, expected 0x000000c0
    [ 49.360619] gs2971 spi3.2: register 00 = 000000c0
    [ 49.372472] gs2971 spi3.2: register 01 = 00000000
    [ 49.381927] gs2971 spi3.2: register 02 = 00000000
    [ 49.388128] gs2971 spi3.2: register 03 = 00000000
    [ 49.394330] gs2971 spi3.2: register 04 = 00000000
    [ 49.399125] gs2971 spi3.2: register 05 = 00004210
    [ 49.406695] gs2971 spi3.2: register 06 = 00000b66
    [ 49.411477] gs2971 spi3.2: register 07 = 00001dff
    [ 49.416513] gs2971 spi3.2: register 08 = 00000820
    [ 49.421368] gs2971 spi3.2: register 09 = 00001883
    [ 49.426253] gs2971 spi3.2: register 0a = 00000000
    [ 49.431108] gs2971 spi3.2: register 0b = 00000000
    [ 49.435989] gs2971 spi3.2: register 0c = 00000000
    [ 49.440805] gs2971 spi3.2: register 0d = 00000000
    [ 49.445689] gs2971 spi3.2: register 0e = 00000000
    [ 49.450556] gs2971 spi3.2: register 0f = 00000000
    [ 49.455431] gs2971 spi3.2: register 10 = 00000000
    [ 49.460283] gs2971 spi3.2: register 11 = 00000000
    [ 49.465207] gs2971 spi3.2: register 12 = 00000000
    [ 49.470028] gs2971 spi3.2: register 13 = 00000000
    [ 49.474827] gs2971 spi3.2: register 14 = 00000000
    [ 49.479694] gs2971 spi3.2: register 15 = 00000000
    [ 49.484498] gs2971 spi3.2: register 16 = 00000000
    [ 49.489282] gs2971 spi3.2: register 17 = 00000000
    [ 49.494110] gs2971 spi3.2: register 18 = 00000000
    [ 49.498898] gs2971 spi3.2: register 19 = 00000000
    [ 49.503704] gs2971 spi3.2: register 1a = 00000000
    [ 49.508490] gs2971 spi3.2: register 1b = 00000000
    [ 49.514315] gs2971 spi3.2: register 1c = 00000000
    [ 49.519101] gs2971 spi3.2: register 1d = 00000000
    [ 49.523905] gs2971 spi3.2: register 1e = 00000000
    [ 49.528690] gs2971 spi3.2: register 1f = 00000780
    [ 49.533493] gs2971 spi3.2: register 20 = 00000898
    [ 49.538276] gs2971 spi3.2: register 21 = 00000465
    [ 49.543078] gs2971 spi3.2: register 22 = 00001438
    [ 49.547863] gs2971 spi3.2: register 23 = 00000003
    [ 49.552681] gs2971 spi3.2: register 24 = 00000004
    [ 49.557464] gs2971 spi3.2: register 25 = 00000022
    [ 49.562187] gs2971_gpio_state: active=1, standby-gpios(0)=0x1
    root@am57xx-evm:/# ls /dev/video
    video0 video10 video11
    root@am57xx-evm:/# lsmod
    Module Size Used by
    gs2971_video 20480 0
    v4l2_int_device 16384 1 gs2971_video
    v4l2_fwnode 20480 0
    pru_rproc 20480 0
    irq_pruss_intc 16384 1 pru_rproc
    pruss 16384 1 pru_rproc
    dwc3 73728 0
    udc_core 28672 1 dwc3
    ahci_platform 16384 0
    libahci_platform 20480 1 ahci_platform
    snd_soc_simple_card 16384 0
    snd_soc_simple_card_utils 16384 1 snd_soc_simple_card
    libahci 36864 2 ahci_platform,libahci_platform
    ti_vip 49152 0
    pvrsrvkm 401408 4
    libata 208896 3 ahci_platform,libahci_platform,libahci
    pruss_soc_bus 16384 0
    omap_aes_driver 24576 0
    omap_sham 28672 0
    omap_wdt 16384 0
    phy_omap_usb2 16384 2
    ti_vpe 32768 0
    ti_sc 36864 2 ti_vpe,ti_vip
    ti_csc 16384 2 ti_vpe,ti_vip
    ti_vpdma 24576 2 ti_vpe,ti_vip
    omap_des 20480 0
    des_generic 28672 1 omap_des
    omap_hdq 16384 0
    crypto_engine 16384 2 omap_des,omap_aes_driver
    snd_soc_tlv320aic3x 57344 1
    wire 32768 1 omap_hdq
    rtc_omap 20480 1
    dwc3_omap 16384 0
    at24 20480 0
    omap_crypto 16384 2 omap_des,omap_aes_driver
    pixcir_i2c_ts 16384 0
    omap_remoteproc 20480 0
    virtio_rpmsg_bus 20480 0
    remoteproc 49152 2 pru_rproc,omap_remoteproc
    sch_fq_codel 20480 3
    uio_module_drv 16384 0
    uio 20480 1 uio_module_drv
    ftdi_sio 40960 0
    usbserial 36864 1 ftdi_sio
    usbcore 217088 2 ftdi_sio,usbserial
    usb_common 16384 3 udc_core,usbcore,dwc3
    jailhouse 32768 0
    gdbserverproxy 16384 0
    cryptodev 49152 0
    root@am57xx-evm:/#


    I am able to read spi data and camera detected GS2971 HD detected.all formats 1920x1080 30p all are detecting when camera connecting time.

    but for am5728 not able to detect vin3a data. any other v4l2_spi_subdev_init we want to add.

    Thanking you,

    regards,

    Ram

  • Hi sir,

    I am added v4l2_spi_subdev_init function but it hangs

    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/platform/mxc/capture/gs2971_video.ko
    [ 85.822628] gs2971 spi3.2: mclk=19bfcc0
    [ 85.826496] gs2971 spi3.2: ipu=1
    [ 85.829746] gs2971_probe:cea861=0
    [ 85.834440] gs2971_gpio_state: active=0, standby-gpios(0)=0x0
    [ 86.872535] gs2971 spi3.2: status=0, read value of 0x000000c0, expected 0x000000c0
    [ 86.880626] gs2971 spi3.2: register 00 = 000000c0
    [ 86.895976] gs2971 spi3.2: register 01 = 00000000
    [ 86.900768] gs2971 spi3.2: register 02 = 00000000
    [ 86.907895] gs2971 spi3.2: register 03 = 00000000
    [ 86.912758] gs2971 spi3.2: register 04 = 00000000
    [ 86.917555] gs2971 spi3.2: register 05 = 00004210
    [ 86.922534] gs2971 spi3.2: register 06 = 00001dff
    [ 86.927331] gs2971 spi3.2: register 07 = 00001dff
    [ 86.932127] gs2971 spi3.2: register 08 = 00000820
    [ 86.936965] gs2971 spi3.2: register 09 = 00001883
    [ 86.941764] gs2971 spi3.2: register 0a = 00000000
    [ 86.946774] gs2971 spi3.2: register 0b = 00000000
    [ 86.951564] gs2971 spi3.2: register 0c = 00000000
    [ 86.956401] gs2971 spi3.2: register 0d = 00000000
    [ 86.961198] gs2971 spi3.2: register 0e = 00000000
    [ 86.966053] gs2971 spi3.2: register 0f = 00000000
    [ 86.970849] gs2971 spi3.2: register 10 = 00000000
    [ 86.975668] gs2971 spi3.2: register 11 = 00000000
    [ 86.980462] gs2971 spi3.2: register 12 = 00000000
    [ 86.985293] gs2971 spi3.2: register 13 = 00000000
    [ 86.990090] gs2971 spi3.2: register 14 = 00000000
    [ 86.994905] gs2971 spi3.2: register 15 = 00000000
    [ 86.999768] gs2971 spi3.2: register 16 = 00000000
    [ 87.004604] gs2971 spi3.2: register 17 = 00000000
    [ 87.009401] gs2971 spi3.2: register 18 = 00000000
    [ 87.014389] gs2971 spi3.2: register 19 = 00000000
    [ 87.019179] gs2971 spi3.2: register 1a = 00000000
    [ 87.024018] gs2971 spi3.2: register 1b = 00000000
    [ 87.028814] gs2971 spi3.2: register 1c = 00000000
    [ 87.033665] gs2971 spi3.2: register 1d = 00000000
    [ 87.038462] gs2971 spi3.2: register 1e = 00000000
    [ 87.043278] gs2971 spi3.2: register 1f = 00000000
    [ 87.048072] gs2971 spi3.2: register 20 = 00000000
    [ 87.052901] gs2971 spi3.2: register 21 = 00000000
    [ 87.057695] gs2971 spi3.2: register 22 = 00008000
    [ 87.062548] gs2971 spi3.2: register 23 = 00000000
    [ 87.062621] gs2971 spi3.2: register 24 = 00000004
    [ 87.062696] gs2971 spi3.2: register 25 = 00000040
    [ 87.062702] gs2971_gpio_state: active=1, standby-gpios(0)=0x1
    [ 87.062709] (NULL device *): v4l2_async_register_subdev Entered
    [ 87.088622] (NULL device *): v4l2_async_notifier_find_v4l2_dev1
    [ 87.094583] (NULL device *): v4l2_async_notifier_find_v4l2_dev2
    [ 87.100525] (NULL device *): v4l2_async_notifier_find_v4l2_dev After loop
    [ 87.107352] (NULL device *): v4l2_async_find_match
    [ 87.112161] (NULL device *): v4l2_async_find_match match_fwnode
    [ 87.118150] (NULL device *): v4l2_async_find_match match_fwnode1
    [ 87.124200] (NULL device *): v4l2_async_match_notify
    [ 87.129182] (NULL device *): v4l2_async_match_notify v4l2_async_notifier_call_bound start
    [ 87.137410] (NULL device *): v4l2_async_notifier_call_bound start
    [ 87.143555] (NULL device *): v4l2_async_notifier_call_bound end
    [ 87.149497] vin3a: Port A: Using subdev gs2971 for capture

  • Hi Ramachandra,

    Which SDK release are you using?
    Can you please cross check if pinmux configuration for VIN data lines and clock lines are proper?

    Also, you can go through the https://software-dl.ti.com/processor-sdk-linux/esd/docs/06_03_00_106/linux/Foundational_Components/Kernel/Kernel_Drivers/Camera/VIP.html for debugging tips. 

    Regards,
    Parth

  • Hi sir,

    i am using ti-processor-sdk-linux-am57xx-evm-06.01.00.08

    U-BOOT version: u-boot-2019.01+gitAUTOINC+029e4c009a-g029e4c009a

    Linux Version : linux-4.19.59+gitAUTOINC+5f8c1c6121-5f8c1c6121

    and i am attaching mux_data.h and all values of vin & clk properly getting(Through oscilloscope i probed).

    /* SPDX-License-Identifier: GPL-2.0+ */
    /*
     * Copyright (C) 2014 Texas Instruments Incorporated - http://www.ti.com
     *
     * Author: Felipe Balbi <balbi@ti.com>
     *
     * Based on board/ti/dra7xx/evm.c
     */
    #ifndef _MUX_DATA_BEAGLE_X15_H_
    #define _MUX_DATA_BEAGLE_X15_H_
    
    #include <asm/arch/mux_dra7xx.h>
    
    const struct pad_conf_entry core_padconf_array_essential_x15[] = {
    //QSPI
    	{GPMC_A13, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a13.qspi1_rtclk */
    	{GPMC_A14, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a14.qspi1_d3 */
    	{GPMC_A15, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a15.qspi1_d2 */
    	{GPMC_A16, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a16.qspi1_d0 */
    	{GPMC_A17, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a17.qspi1_d1 */
    	{GPMC_A18, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_a18.qspi1_sclk */
    	{GPMC_CS2, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_cs2.qspi1_cs0 */
    
    	{MDIO_MCLK, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* mdio_mclk.mdio_mclk */
    	{MDIO_D, (M0 | PIN_INPUT | SLEWCONTROL)},	/* mdio_d.mdio_d */
    
    	{RMII_MHZ_50_CLK, (M14 | PIN_INPUT_PULLUP)},	/* RMII_MHZ_50_CLK.gpio5_17 */
    //Ethernet
    	{RGMII0_TXC, (M0 | PIN_OUTPUT | MANUAL_MODE)},	/* rgmii0_txc.rgmii0_txc */
    	{RGMII0_TXCTL, (M0 | PIN_OUTPUT | MANUAL_MODE)},	/* rgmii0_txctl.rgmii0_txctl */
    	{RGMII0_TXD3, (M0 | PIN_OUTPUT | MANUAL_MODE)},	/* rgmii0_txd3.rgmii0_txd3 */
    	{RGMII0_TXD2, (M0 | PIN_OUTPUT | MANUAL_MODE)},	/* rgmii0_txd2.rgmii0_txd2 */
    	{RGMII0_TXD1, (M0 | PIN_OUTPUT | MANUAL_MODE)},	/* rgmii0_txd1.rgmii0_txd1 */
    	{RGMII0_TXD0, (M0 | PIN_OUTPUT | MANUAL_MODE)},	/* rgmii0_txd0.rgmii0_txd0 */
    	{RGMII0_RXC, (M0 | PIN_INPUT | MANUAL_MODE)},	/* rgmii0_rxc.rgmii0_rxc */
    	{RGMII0_RXCTL, (M0 | PIN_INPUT | MANUAL_MODE)},	/* rgmii0_rxctl.rgmii0_rxctl */
    	{RGMII0_RXD3, (M0 | PIN_INPUT | MANUAL_MODE)},	/* rgmii0_rxd3.rgmii0_rxd3 */
    	{RGMII0_RXD2, (M0 | PIN_INPUT | MANUAL_MODE)},	/* rgmii0_rxd2.rgmii0_rxd2 */
    	{RGMII0_RXD1, (M0 | PIN_INPUT | MANUAL_MODE)},	/* rgmii0_rxd1.rgmii0_rxd1 */
    	{RGMII0_RXD0, (M0 | PIN_INPUT | MANUAL_MODE)},	/* rgmii0_rxd0.rgmii0_rxd0 */
    
    	{XREF_CLK3, (M9 | PIN_OUTPUT_PULLDOWN)},	/* xref_clk3.clkout3 */
    //spi3
    	{MCASP1_AXR8, (M3 | PIN_INPUT )},	/* mcasp1_axr8.spi3_sclk */
    	{MCASP1_AXR9, (M3 | PIN_INPUT )},	/* mcasp1_axr9.spi3_d1 */
    	{MCASP1_AXR10, (M3 | PIN_OUTPUT )},	/* mcasp1_axr10.spi3_d0 */
    	{MCASP1_AXR11, (M3 | PIN_OUTPUT )},	/* mcasp1_axr11.spi3_cs	 */
    //SD-Card
    	{MMC1_CLK, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_clk.mmc1_clk */
    	{MMC1_CMD, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_cmd.mmc1_cmd */
    	{MMC1_DAT0, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat0.mmc1_dat0 */
    	{MMC1_DAT1, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat1.mmc1_dat1 */
    	{MMC1_DAT2, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat2.mmc1_dat2 */
    	{MMC1_DAT3, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat3.mmc1_dat3 */
    	{MMC1_SDCD, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdcd.gpio6_27 */
    
    	{SPI1_D1, (M14 | PIN_INPUT_PULLDOWN)},	/* spi1_d1.gpio7_8 */
    //UART
    	{UART2_TXD, (M14 | PIN_INPUT_PULLDOWN)},	/* uart2_txd.gpio7_27 */	
    	{UART2_CTSN, (M2 | PIN_INPUT_PULLUP)},	/* uart2_ctsn.uart3_rxd */
    	{UART2_RTSN, (M1 | PIN_OUTPUT)},	/* uart2_rtsn.uart3_txd */
    //I2C
    	{I2C1_SDA, (M0 | PIN_INPUT_PULLUP)},	/* i2c1_sda.i2c1_sda */
    	{I2C1_SCL, (M0 | PIN_INPUT_PULLUP)},	/* i2c1_scl.i2c1_scl */
    //General Wakeup
    	{WAKEUP0, (M0 | PIN_INPUT)},	/* Wakeup0.Wakeup0 */
    	{WAKEUP1, (M0 | PIN_INPUT)},	/* Wakeup1.Wakeup1 */
    	{WAKEUP2, (M0 | PIN_INPUT)},	/* Wakeup2.Wakeup2 */
    	{WAKEUP3, (M0 | PIN_INPUT)},	/* Wakeup3.Wakeup3 */
    	{ON_OFF, (M0 | PIN_OUTPUT)},	/* on_off.on_off */
    	{RTC_PORZ, (M0 | PIN_INPUT)},	/* rtc_porz.rtc_porz */
    	{TMS, (M0 | PIN_INPUT_PULLUP)},	/* tms.tms */
    	{TDI, (M0 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* tdi.tdi */
    	{TDO, (M0 | PIN_OUTPUT)},	/* tdo.tdo */
    	{TCLK, (M0 | PIN_INPUT_PULLDOWN)},	/* tclk.tclk */
    	{TRSTN, (M0 | PIN_INPUT)},	/* trstn.trstn */
    	{RTCK, (M0 | PIN_OUTPUT)},	/* rtck.rtck */
    	{EMU0, (M0 | PIN_INPUT)},	/* emu0.emu0 */
    	{EMU1, (M0 | PIN_INPUT)},	/* emu1.emu1 */
    	{NMIN_DSP, (M0 | PIN_INPUT)},	/* nmin_dsp.nmin_dsp */
    	{RSTOUTN, (M0 | PIN_OUTPUT)},	/* rstoutn.rstoutn */
    };
    
    const struct pad_conf_entry core_padconf_array_delta_x15_sr1_1[] = {
    	{VOUT1_DE, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_de.vin3a_de */
    	{VOUT1_HSYNC, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_hsync.vin3a_hsync */
    	{VOUT1_VSYNC, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_vsync.vin3a_vsync */
    	{VOUT1_D8,  (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d8.vin3a_d8 */
    	{VOUT1_D9,  (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d9.vin3a_d9 */
    	{VOUT1_D10, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d10.vin3a_d10 */
    	{VOUT1_D11, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d11.vin3a_d11 */
    	{VOUT1_D12, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d12.vin3a_d12 */
    	{VOUT1_D13, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d13.vin3a_d13 */
    	{VOUT1_D14, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d14.vin3a_d14 */
    	{VOUT1_D15, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d15.vin3a_d15 */
    	{VOUT1_D16, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d16.vin3a_d0 */
    	{VOUT1_D17, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d17.vin3a_d1 */
    	{VOUT1_D18, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d18.vin3a_d2 */
    	{VOUT1_D19, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d19.vin3a_d3 */
    	{VOUT1_D20, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d20.vin3a_d4 */
    	{VOUT1_D21, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d21.vin3a_d5 */
    	{VOUT1_D22, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d22.vin3a_d6 */
    	{VOUT1_D23, (M4 | PIN_INPUT | MANUAL_MODE)},	/* vout1_d23.vin3a_d7 */
    	{VOUT1_FLD, (M4 | PIN_INPUT | MANUAL_MODE )},	/* vout1_fld.vin3a_clk */
    };
    
    const struct pad_conf_entry core_padconf_array_delta_x15_sr2_0[] = {
    	{VOUT1_DE, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_de.vin3a_clk */
    	{VOUT1_HSYNC, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_hsync.vin3a_hsync */
    	{VOUT1_VSYNC, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_vsync.vin3a_vsync */
    	{VOUT1_D8, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d8.vin3a_d8 */
    	{VOUT1_D9, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d9.vin3a_d9 */
    	{VOUT1_D10, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d10.vin3a_d10 */
    	{VOUT1_D11, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d11.vin3a_d11 */
    	{VOUT1_D12, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d12.vin3a_d12 */
    	{VOUT1_D13, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d13.vin3a_d13 */
    	{VOUT1_D14, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d14.vin3a_d14 */
    	{VOUT1_D15, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d15.vin3a_d15 */
    	{VOUT1_D16, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d16.vin3a_d0 */
    	{VOUT1_D17, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d17.vin3a_d1 */
    	{VOUT1_D18, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d18.vin3a_d2 */
    	{VOUT1_D19, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d19.vin3a_d3 */
    	{VOUT1_D20, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d20.vin3a_d4 */
    	{VOUT1_D21, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d21.vin3a_d5 */
    	{VOUT1_D22, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d22.vin3a_d6 */
    	{VOUT1_D23, (M4 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vout1_d23.vin3a_d7 */
    };
    
    const struct pad_conf_entry core_padconf_array_essential_am574x_idk[] = {
    	{GPMC_A0, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a0.vin4b_d0 */
    	{GPMC_A1, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a1.vin4b_d1 */
    	{GPMC_A2, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a2.vin4b_d2 */
    	{GPMC_A3, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a3.vin4b_d3 */
    	{GPMC_A4, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a4.vin4b_d4 */
    	{GPMC_A5, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a5.vin4b_d5 */
    	{GPMC_A6, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a6.vin4b_d6 */
    	{GPMC_A7, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a7.vin4b_d7 */
    	{GPMC_A8, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a8.vin4b_hsync1 */
    	{GPMC_A9, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a9.vin4b_vsync1 */
    	{GPMC_A10, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a10.vin4b_clk1 */
    	{GPMC_A11, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a11.vin4b_de1 */
    	{GPMC_A12, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a12.vin4b_fld1 */
    	{GPMC_A13, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a13.qspi1_rtclk */
    	{GPMC_A14, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a14.qspi1_d3 */
    	{GPMC_A15, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a15.qspi1_d2 */
    	{GPMC_A16, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a16.qspi1_d0 */
    	{GPMC_A17, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a17.qspi1_d1 */
    	{GPMC_A18, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_a18.qspi1_sclk */
    	{GPMC_A19, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a19.mmc2_dat4 */
    	{GPMC_A20, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a20.mmc2_dat5 */
    	{GPMC_A21, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a21.mmc2_dat6 */
    	{GPMC_A22, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a22.mmc2_dat7 */
    	{GPMC_A23, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a23.mmc2_clk */
    	{GPMC_A24, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a24.mmc2_dat0 */
    	{GPMC_A25, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a25.mmc2_dat1 */
    	{GPMC_A26, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a26.mmc2_dat2 */
    	{GPMC_A27, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a27.mmc2_dat3 */
    	{GPMC_CS1, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_cs1.mmc2_cmd */
    	{GPMC_CS2, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_cs2.qspi1_cs0 */
    	{VIN1A_D5, (M14 | PIN_OUTPUT)},	/* vin1a_d5.gpio3_9 */
    	{VIN1A_D6, (M14 | PIN_OUTPUT)},	/* vin1a_d6.gpio3_10 */
    	{VIN1A_D7, (M14 | PIN_OUTPUT)},	/* vin1a_d7.gpio3_11 */
    	{VIN1A_D8, (M14 | PIN_OUTPUT)},	/* vin1a_d8.gpio3_12 */
    	{VIN1A_D10, (M14 | PIN_INPUT_PULLDOWN)},	/* vin1a_d10.gpio3_14 */
    	{VIN1A_D12, (M14 | PIN_INPUT)},	/* vin1a_d12.gpio3_16 */
    	{VIN1A_D13, (M14 | PIN_OUTPUT)},	/* vin1a_d13.gpio3_17 */
    	{VIN1A_D14, (M14 | PIN_OUTPUT)},	/* vin1a_d14.gpio3_18 */
    	{VIN1A_D15, (M14 | PIN_OUTPUT)},	/* vin1a_d15.gpio3_19 */
    	{VIN1A_D17, (M14 | PIN_OUTPUT)},	/* vin1a_d17.gpio3_21 */
    	{VIN1A_D18, (M14 | PIN_OUTPUT_PULLDOWN)},	/* vin1a_d18.gpio3_22 */
    	{VIN1A_D19, (M14 | PIN_OUTPUT_PULLUP)},	/* vin1a_d19.gpio3_23 */
    	{VIN1A_D22, (M14 | PIN_INPUT)},	/* vin1a_d22.gpio3_26 */
    	{VIN2A_CLK0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_clk0.gpio3_28 */
    	{VIN2A_DE0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_de0.gpio3_29 */
    	{VIN2A_FLD0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_fld0.gpio3_30 */
    	{VIN2A_HSYNC0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_hsync0.gpio3_31 */
    	{VIN2A_VSYNC0, (M14 | PIN_INPUT)},	/* vin2a_vsync0.gpio4_0 */
    	{VIN2A_D0, (M11 | PIN_INPUT)},	/* vin2a_d0.pr1_uart0_rxd */
    	{VIN2A_D1, (M11 | PIN_OUTPUT)},	/* vin2a_d1.pr1_uart0_txd */
    	{VIN2A_D2, (M10 | PIN_OUTPUT)},	/* vin2a_d2.eCAP1_in_PWM1_out */
    	{VIN2A_D3, (M11 | PIN_INPUT_PULLDOWN)},	/* vin2a_d3.pr1_edc_latch0_in */
    	{VIN2A_D4, (M11 | PIN_OUTPUT)},	/* vin2a_d4.pr1_edc_sync0_out */
    	{VIN2A_D5, (M13 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d5.pr1_pru1_gpo2 */
    	{VIN2A_D10, (M11 | PIN_OUTPUT_PULLDOWN)},	/* vin2a_d10.pr1_mdio_mdclk */
    	{VIN2A_D11, (M11 | PIN_INPUT)},	/* vin2a_d11.pr1_mdio_data */
    	{VIN2A_D12, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d12.rgmii1_txc */
    	{VIN2A_D13, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d13.rgmii1_txctl */
    	{VIN2A_D14, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d14.rgmii1_txd3 */
    	{VIN2A_D15, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d15.rgmii1_txd2 */
    	{VIN2A_D16, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d16.rgmii1_txd1 */
    	{VIN2A_D17, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d17.rgmii1_txd0 */
    	{VIN2A_D18, (M3 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d18.rgmii1_rxc */
    	{VIN2A_D19, (M3 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d19.rgmii1_rxctl */
    	{VIN2A_D20, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d20.rgmii1_rxd3 */
    	{VIN2A_D21, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d21.rgmii1_rxd2 */
    	{VIN2A_D22, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d22.rgmii1_rxd1 */
    	{VIN2A_D23, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d23.rgmii1_rxd0 */
    	{VOUT1_CLK, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_clk.vout1_clk */
    	{VOUT1_DE, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_de.vout1_de */
    	{VOUT1_FLD, (M14 | PIN_OUTPUT)},	/* vout1_fld.gpio4_21 */
    	{VOUT1_HSYNC, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_hsync.vout1_hsync */
    	{VOUT1_VSYNC, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_vsync.vout1_vsync */
    	{VOUT1_D0, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d0.vout1_d0 */
    	{VOUT1_D1, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d1.vout1_d1 */
    	{VOUT1_D2, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d2.vout1_d2 */
    	{VOUT1_D3, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d3.vout1_d3 */
    	{VOUT1_D4, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d4.vout1_d4 */
    	{VOUT1_D5, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d5.vout1_d5 */
    	{VOUT1_D6, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d6.vout1_d6 */
    	{VOUT1_D7, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d7.vout1_d7 */
    	{VOUT1_D8, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d8.vout1_d8 */
    	{VOUT1_D9, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d9.vout1_d9 */
    	{VOUT1_D10, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d10.vout1_d10 */
    	{VOUT1_D11, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d11.vout1_d11 */
    	{VOUT1_D12, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d12.vout1_d12 */
    	{VOUT1_D13, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d13.vout1_d13 */
    	{VOUT1_D14, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d14.vout1_d14 */
    	{VOUT1_D15, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d15.vout1_d15 */
    	{VOUT1_D16, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d16.vout1_d16 */
    	{VOUT1_D17, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d17.vout1_d17 */
    	{VOUT1_D18, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d18.vout1_d18 */
    	{VOUT1_D19, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d19.vout1_d19 */
    	{VOUT1_D20, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d20.vout1_d20 */
    	{VOUT1_D21, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d21.vout1_d21 */
    	{VOUT1_D22, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d22.vout1_d22 */
    	{VOUT1_D23, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d23.vout1_d23 */
    	{MDIO_MCLK, (M0 | PIN_INPUT_SLEW)},	/* mdio_mclk.mdio_mclk */
    	{MDIO_D, (M0 | PIN_INPUT | SLEWCONTROL)},	/* mdio_d.mdio_d */
    	{RGMII0_TXC, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txc.rgmii0_txc */
    	{RGMII0_TXCTL, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txctl.rgmii0_txctl */
    	{RGMII0_TXD3, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd3.rgmii0_txd3 */
    	{RGMII0_TXD2, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd2.rgmii0_txd2 */
    	{RGMII0_TXD1, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd1.rgmii0_txd1 */
    	{RGMII0_TXD0, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd0.rgmii0_txd0 */
    	{RGMII0_RXC, (M0 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_rxc.rgmii0_rxc */
    	{RGMII0_RXCTL, (M0 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_rxctl.rgmii0_rxctl */
    	{RGMII0_RXD3, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd3.rgmii0_rxd3 */
    	{RGMII0_RXD2, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd2.rgmii0_rxd2 */
    	{RGMII0_RXD1, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd1.rgmii0_rxd1 */
    	{RGMII0_RXD0, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd0.rgmii0_rxd0 */
    	{USB1_DRVVBUS, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* usb1_drvvbus.usb1_drvvbus */
    	{USB2_DRVVBUS, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* usb2_drvvbus.usb2_drvvbus */
    	{GPIO6_14, (M0 | PIN_OUTPUT)},	/* gpio6_14.gpio6_14 */
    	{GPIO6_15, (M0 | PIN_OUTPUT)},	/* gpio6_15.gpio6_15 */
    	{GPIO6_16, (M0 | PIN_INPUT_PULLUP)},	/* gpio6_16.gpio6_16 */
    	{XREF_CLK0, (M11 | PIN_INPUT_PULLDOWN)},	/* xref_clk0.pr2_mii1_col */
    	{XREF_CLK1, (M11 | PIN_INPUT_PULLDOWN)},	/* xref_clk1.pr2_mii1_crs */
    	{XREF_CLK2, (M14 | PIN_OUTPUT)},	/* xref_clk2.gpio6_19 */
    	{XREF_CLK3, (M9 | PIN_OUTPUT_PULLDOWN)},	/* xref_clk3.clkout3 */
    	{MCASP1_ACLKX, (M11 | PIN_OUTPUT_PULLDOWN)},	/* mcasp1_aclkx.pr2_mdio_mdclk */
    	{MCASP1_FSX, (M11 | PIN_INPUT | SLEWCONTROL)},	/* mcasp1_fsx.pr2_mdio_data */
    	{MCASP1_ACLKR, (M14 | PIN_INPUT)},	/* mcasp1_aclkr.gpio5_0 */
    	{MCASP1_FSR, (M14 | PIN_INPUT)},	/* mcasp1_fsr.gpio5_1 */
    	{MCASP1_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr0.pr2_mii0_rxer */
    	{MCASP1_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr1.pr2_mii_mt0_clk */
    	{MCASP1_AXR2, (M14 | PIN_INPUT)},	/* mcasp1_axr2.gpio5_4 */
    	{MCASP1_AXR3, (M14 | PIN_INPUT)},	/* mcasp1_axr3.gpio5_5 */
    	{MCASP1_AXR4, (M14 | PIN_OUTPUT)},	/* mcasp1_axr4.gpio5_6 */
    	{MCASP1_AXR5, (M14 | PIN_OUTPUT)},	/* mcasp1_axr5.gpio5_7 */
    	{MCASP1_AXR6, (M14 | PIN_OUTPUT)},	/* mcasp1_axr6.gpio5_8 */
    	{MCASP1_AXR7, (M14 | PIN_OUTPUT)},	/* mcasp1_axr7.gpio5_9 */
    	{MCASP1_AXR8, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr8.pr2_mii0_txen */
    	{MCASP1_AXR9, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr9.pr2_mii0_txd3 */
    	{MCASP1_AXR10, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr10.pr2_mii0_txd2 */
    	{MCASP1_AXR11, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr11.pr2_mii0_txd1 */
    	{MCASP1_AXR12, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr12.pr2_mii0_txd0 */
    	{MCASP1_AXR13, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr13.pr2_mii_mr0_clk */
    	{MCASP1_AXR14, (M11 | PIN_INPUT_SLEW)},	/* mcasp1_axr14.pr2_mii0_rxdv */
    	{MCASP1_AXR15, (M11 | PIN_INPUT_SLEW)},	/* mcasp1_axr15.pr2_mii0_rxd3 */
    	{MCASP2_ACLKX, (M11 | PIN_INPUT_PULLDOWN)},	/* mcasp2_aclkx.pr2_mii0_rxd2 */
    	{MCASP2_FSX, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_fsx.pr2_mii0_rxd1 */
    	{MCASP2_AXR2, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_axr2.pr2_mii0_rxd0 */
    	{MCASP2_AXR3, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_axr3.pr2_mii0_rxlink */
    	{MCASP2_AXR4, (M14 | PIN_INPUT)},	/* mcasp2_axr4.gpio1_4 */
    	{MCASP2_AXR5, (M14 | PIN_OUTPUT)},	/* mcasp2_axr5.gpio6_7 */
    	{MCASP2_AXR6, (M14 | PIN_OUTPUT)},	/* mcasp2_axr6.gpio2_29 */
    	{MCASP2_AXR7, (M14 | PIN_INPUT)},	/* mcasp2_axr7.gpio1_5 */
    	{MCASP3_ACLKX, (M11 | PIN_INPUT_PULLDOWN)},	/* mcasp3_aclkx.pr2_mii0_crs */
    	{MCASP3_FSX, (M11 | PIN_INPUT_SLEW)},	/* mcasp3_fsx.pr2_mii0_col */
    	{MCASP3_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp3_axr0.pr2_mii1_rxer */
    	{MCASP3_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp3_axr1.pr2_mii1_rxlink */
    	{MCASP4_ACLKX, (M2 | PIN_INPUT)},	/* mcasp4_aclkx.spi3_sclk */
    	{MCASP4_FSX, (M2 | PIN_INPUT)},	/* mcasp4_fsx.spi3_d1 */
    	{MCASP4_AXR1, (M2 | PIN_INPUT_PULLUP)},	/* mcasp4_axr1.spi3_cs0 */
    	{MCASP5_ACLKX, (M13 | PIN_OUTPUT | MANUAL_MODE)},	/* mcasp5_aclkx.pr2_pru1_gpo1 */
    	{MCASP5_FSX, (M12 | PIN_INPUT | MANUAL_MODE)},	/* mcasp5_fsx.pr2_pru1_gpi2 */
    	{MMC1_CLK, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_clk.mmc1_clk */
    	{MMC1_CMD, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_cmd.mmc1_cmd */
    	{MMC1_DAT0, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat0.mmc1_dat0 */
    	{MMC1_DAT1, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat1.mmc1_dat1 */
    	{MMC1_DAT2, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat2.mmc1_dat2 */
    	{MMC1_DAT3, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat3.mmc1_dat3 */
    	{MMC1_SDCD, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdcd.gpio6_27 */
    	{MMC1_SDWP, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdwp.gpio6_28 */
    	{GPIO6_10, (M11 | PIN_INPUT_PULLUP)},	/* gpio6_10.pr2_mii_mt1_clk */
    	{GPIO6_11, (M11 | PIN_OUTPUT_PULLUP)},	/* gpio6_11.pr2_mii1_txen */
    	{MMC3_CLK, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_clk.pr2_mii1_txd3 */
    	{MMC3_CMD, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_cmd.pr2_mii1_txd2 */
    	{MMC3_DAT0, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_dat0.pr2_mii1_txd1 */
    	{MMC3_DAT1, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_dat1.pr2_mii1_txd0 */
    	{MMC3_DAT2, (M11 | PIN_INPUT_PULLUP)},	/* mmc3_dat2.pr2_mii_mr1_clk */
    	{MMC3_DAT3, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat3.pr2_mii1_rxdv */
    	{MMC3_DAT4, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat4.pr2_mii1_rxd3 */
    	{MMC3_DAT5, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat5.pr2_mii1_rxd2 */
    	{MMC3_DAT6, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat6.pr2_mii1_rxd1 */
    	{MMC3_DAT7, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat7.pr2_mii1_rxd0 */
    	{SPI1_SCLK, (M14 | PIN_OUTPUT)},	/* spi1_sclk.gpio7_7 */
    	{SPI1_D1, (M14 | PIN_OUTPUT)},	/* spi1_d1.gpio7_8 */
    	{SPI1_D0, (M14 | PIN_OUTPUT)},	/* spi1_d0.gpio7_9 */
    	{SPI1_CS0, (M14 | PIN_OUTPUT)},	/* spi1_cs0.gpio7_10 */
    	{SPI1_CS1, (M14 | PIN_OUTPUT)},	/* spi1_cs1.gpio7_11 */
    	{SPI1_CS2, (M14 | PIN_INPUT_SLEW)},	/* spi1_cs2.gpio7_12 */
    	{SPI1_CS3, (M6 | PIN_INPUT | SLEWCONTROL)},	/* spi1_cs3.hdmi1_cec */
    	{SPI2_SCLK, (M0 | PIN_INPUT)},	/* spi2_sclk.spi2_sclk */
    	{SPI2_D1, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_d1.spi2_d1 */
    	{SPI2_D0, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_d0.spi2_d0 */
    	{SPI2_CS0, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_cs0.spi2_cs0 */
    	{DCAN1_TX, (M15 | PULL_UP)},	/* dcan1_tx.safe for dcan1_tx */
    	{DCAN1_RX, (M15 | PULL_UP)},	/* dcan1_rx.safe for dcan1_rx */
    	{UART1_RXD, (M14 | PIN_OUTPUT | SLEWCONTROL)},	/* uart1_rxd.gpio7_22 */
    	{UART1_TXD, (M14 | PIN_OUTPUT | SLEWCONTROL)},	/* uart1_txd.gpio7_23 */
    	{UART2_RXD, (M4 | PIN_INPUT)},	/* uart2_rxd.uart2_rxd */
    	{UART2_TXD, (M0 | PIN_OUTPUT)},	/* uart2_txd.uart2_txd */
    	{UART2_CTSN, (M2 | PIN_INPUT)},	/* uart2_ctsn.uart3_rxd */
    	{UART2_RTSN, (M1 | PIN_OUTPUT)},	/* uart2_rtsn.uart3_txd */
    	{I2C1_SDA, (M0 | PIN_INPUT)},	/* i2c1_sda.i2c1_sda */
    	{I2C1_SCL, (M0 | PIN_INPUT)},	/* i2c1_scl.i2c1_scl */
    	{I2C2_SDA, (M1 | PIN_INPUT)},	/* i2c2_sda.hdmi1_ddc_scl */
    	{I2C2_SCL, (M1 | PIN_INPUT)},	/* i2c2_scl.hdmi1_ddc_sda */
    	{WAKEUP0, (M0 | PIN_INPUT)},	/* Wakeup0.Wakeup0 */
    	{WAKEUP1, (M0 | PIN_INPUT)},	/* Wakeup1.Wakeup1 */
    	{WAKEUP2, (M0 | PIN_INPUT)},	/* Wakeup2.Wakeup2 */
    	{WAKEUP3, (M0 | PIN_INPUT)},	/* Wakeup3.Wakeup3 */
    	{ON_OFF, (M0 | PIN_OUTPUT)},	/* on_off.on_off */
    	{RTC_PORZ, (M0 | PIN_INPUT)},	/* rtc_porz.rtc_porz */
    	{TMS, (M0 | PIN_INPUT_PULLUP)},	/* tms.tms */
    	{TDI, (M0 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* tdi.tdi */
    	{TDO, (M0 | PIN_OUTPUT_PULLUP)},	/* tdo.tdo */
    	{TCLK, (M0 | PIN_INPUT_PULLUP)},	/* tclk.tclk */
    	{TRSTN, (M0 | PIN_INPUT_PULLDOWN)},	/* trstn.trstn */
    	{RTCK, (M0 | PIN_OUTPUT_PULLUP)},	/* rtck.rtck */
    	{EMU0, (M0 | PIN_INPUT_PULLUP)},	/* emu0.emu0 */
    	{EMU1, (M0 | PIN_INPUT_PULLUP)},	/* emu1.emu1 */
    	{RESETN, (M0 | PIN_INPUT)},	/* resetn.resetn */
    	{NMIN_DSP, (M0 | PIN_INPUT)},	/* nmin_dsp.nmin_dsp */
    	{RSTOUTN, (M0 | PIN_OUTPUT)},	/* rstoutn.rstoutn */
    };
    
    const struct pad_conf_entry core_padconf_array_essential_am572x_idk[] = {
    	{GPMC_A0, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a0.vin4b_d0 */
    	{GPMC_A1, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a1.vin4b_d1 */
    	{GPMC_A2, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a2.vin4b_d2 */
    	{GPMC_A3, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a3.vin4b_d3 */
    	{GPMC_A4, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a4.vin4b_d4 */
    	{GPMC_A5, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a5.vin4b_d5 */
    	{GPMC_A6, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a6.vin4b_d6 */
    	{GPMC_A7, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a7.vin4b_d7 */
    	{GPMC_A8, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a8.vin4b_hsync1 */
    	{GPMC_A9, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a9.vin4b_vsync1 */
    	{GPMC_A10, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a10.vin4b_clk1 */
    	{GPMC_A11, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a11.vin4b_de1 */
    	{GPMC_A12, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a12.vin4b_fld1 */
    	{GPMC_A13, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a13.qspi1_rtclk */
    	{GPMC_A14, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a14.qspi1_d3 */
    	{GPMC_A15, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a15.qspi1_d2 */
    	{GPMC_A16, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a16.qspi1_d0 */
    	{GPMC_A17, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a17.qspi1_d1 */
    	{GPMC_A18, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_a18.qspi1_sclk */
    	{GPMC_A19, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a19.mmc2_dat4 */
    	{GPMC_A20, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a20.mmc2_dat5 */
    	{GPMC_A21, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a21.mmc2_dat6 */
    	{GPMC_A22, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a22.mmc2_dat7 */
    	{GPMC_A23, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a23.mmc2_clk */
    	{GPMC_A24, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a24.mmc2_dat0 */
    	{GPMC_A25, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a25.mmc2_dat1 */
    	{GPMC_A26, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a26.mmc2_dat2 */
    	{GPMC_A27, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a27.mmc2_dat3 */
    	{GPMC_CS1, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_cs1.mmc2_cmd */
    	{GPMC_CS2, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_cs2.qspi1_cs0 */
    	{VIN1A_D5, (M14 | PIN_OUTPUT)},	/* vin1a_d5.gpio3_9 */
    	{VIN1A_D6, (M14 | PIN_OUTPUT)},	/* vin1a_d6.gpio3_10 */
    	{VIN1A_D7, (M14 | PIN_OUTPUT)},	/* vin1a_d7.gpio3_11 */
    	{VIN1A_D8, (M14 | PIN_OUTPUT)},	/* vin1a_d8.gpio3_12 */
    	{VIN1A_D10, (M14 | PIN_INPUT_PULLDOWN)},	/* vin1a_d10.gpio3_14 */
    	{VIN1A_D12, (M14 | PIN_INPUT)},	/* vin1a_d12.gpio3_16 */
    	{VIN1A_D13, (M14 | PIN_OUTPUT)},	/* vin1a_d13.gpio3_17 */
    	{VIN1A_D14, (M14 | PIN_OUTPUT)},	/* vin1a_d14.gpio3_18 */
    	{VIN1A_D15, (M14 | PIN_OUTPUT)},	/* vin1a_d15.gpio3_19 */
    	{VIN1A_D17, (M14 | PIN_OUTPUT)},	/* vin1a_d17.gpio3_21 */
    	{VIN1A_D18, (M14 | PIN_OUTPUT_PULLDOWN)},	/* vin1a_d18.gpio3_22 */
    	{VIN1A_D19, (M14 | PIN_OUTPUT_PULLUP)},	/* vin1a_d19.gpio3_23 */
    	{VIN1A_D22, (M14 | PIN_INPUT)},	/* vin1a_d22.gpio3_26 */
    	{VIN2A_CLK0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_clk0.gpio3_28 */
    	{VIN2A_DE0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_de0.gpio3_29 */
    	{VIN2A_FLD0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_fld0.gpio3_30 */
    	{VIN2A_HSYNC0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_hsync0.gpio3_31 */
    	{VIN2A_VSYNC0, (M14 | PIN_INPUT)},	/* vin2a_vsync0.gpio4_0 */
    	{VIN2A_D0, (M11 | PIN_INPUT)},	/* vin2a_d0.pr1_uart0_rxd */
    	{VIN2A_D1, (M11 | PIN_OUTPUT)},	/* vin2a_d1.pr1_uart0_txd */
    	{VIN2A_D2, (M10 | PIN_OUTPUT)},	/* vin2a_d2.eCAP1_in_PWM1_out */
    	{VIN2A_D3, (M11 | PIN_INPUT_PULLDOWN)},	/* vin2a_d3.pr1_edc_latch0_in */
    	{VIN2A_D4, (M11 | PIN_OUTPUT)},	/* vin2a_d4.pr1_edc_sync0_out */
    	{VIN2A_D5, (M13 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d5.pr1_pru1_gpo2 */
    	{VIN2A_D10, (M11 | PIN_OUTPUT_PULLDOWN)},	/* vin2a_d10.pr1_mdio_mdclk */
    	{VIN2A_D11, (M11 | PIN_INPUT)},	/* vin2a_d11.pr1_mdio_data */
    	{VIN2A_D12, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d12.rgmii1_txc */
    	{VIN2A_D13, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d13.rgmii1_txctl */
    	{VIN2A_D14, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d14.rgmii1_txd3 */
    	{VIN2A_D15, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d15.rgmii1_txd2 */
    	{VIN2A_D16, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d16.rgmii1_txd1 */
    	{VIN2A_D17, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d17.rgmii1_txd0 */
    	{VIN2A_D18, (M3 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d18.rgmii1_rxc */
    	{VIN2A_D19, (M3 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d19.rgmii1_rxctl */
    	{VIN2A_D20, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d20.rgmii1_rxd3 */
    	{VIN2A_D21, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d21.rgmii1_rxd2 */
    	{VIN2A_D22, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d22.rgmii1_rxd1 */
    	{VIN2A_D23, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d23.rgmii1_rxd0 */
    	{VOUT1_CLK, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_clk.vout1_clk */
    	{VOUT1_DE, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_de.vout1_de */
    	{VOUT1_FLD, (M14 | PIN_OUTPUT)},	/* vout1_fld.gpio4_21 */
    	{VOUT1_HSYNC, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_hsync.vout1_hsync */
    	{VOUT1_VSYNC, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_vsync.vout1_vsync */
    	{VOUT1_D0, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d0.vout1_d0 */
    	{VOUT1_D1, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d1.vout1_d1 */
    	{VOUT1_D2, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d2.vout1_d2 */
    	{VOUT1_D3, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d3.vout1_d3 */
    	{VOUT1_D4, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d4.vout1_d4 */
    	{VOUT1_D5, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d5.vout1_d5 */
    	{VOUT1_D6, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d6.vout1_d6 */
    	{VOUT1_D7, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d7.vout1_d7 */
    	{VOUT1_D8, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d8.vout1_d8 */
    	{VOUT1_D9, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d9.vout1_d9 */
    	{VOUT1_D10, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d10.vout1_d10 */
    	{VOUT1_D11, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d11.vout1_d11 */
    	{VOUT1_D12, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d12.vout1_d12 */
    	{VOUT1_D13, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d13.vout1_d13 */
    	{VOUT1_D14, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d14.vout1_d14 */
    	{VOUT1_D15, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d15.vout1_d15 */
    	{VOUT1_D16, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d16.vout1_d16 */
    	{VOUT1_D17, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d17.vout1_d17 */
    	{VOUT1_D18, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d18.vout1_d18 */
    	{VOUT1_D19, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d19.vout1_d19 */
    	{VOUT1_D20, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d20.vout1_d20 */
    	{VOUT1_D21, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d21.vout1_d21 */
    	{VOUT1_D22, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d22.vout1_d22 */
    	{VOUT1_D23, (M0 | PIN_OUTPUT | SLEWCONTROL | MANUAL_MODE)},	/* vout1_d23.vout1_d23 */
    	{MDIO_MCLK, (M0 | PIN_INPUT_SLEW)},	/* mdio_mclk.mdio_mclk */
    	{MDIO_D, (M0 | PIN_INPUT | SLEWCONTROL)},	/* mdio_d.mdio_d */
    	{RGMII0_TXC, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txc.rgmii0_txc */
    	{RGMII0_TXCTL, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txctl.rgmii0_txctl */
    	{RGMII0_TXD3, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd3.rgmii0_txd3 */
    	{RGMII0_TXD2, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd2.rgmii0_txd2 */
    	{RGMII0_TXD1, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd1.rgmii0_txd1 */
    	{RGMII0_TXD0, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd0.rgmii0_txd0 */
    	{RGMII0_RXC, (M0 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_rxc.rgmii0_rxc */
    	{RGMII0_RXCTL, (M0 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_rxctl.rgmii0_rxctl */
    	{RGMII0_RXD3, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd3.rgmii0_rxd3 */
    	{RGMII0_RXD2, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd2.rgmii0_rxd2 */
    	{RGMII0_RXD1, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd1.rgmii0_rxd1 */
    	{RGMII0_RXD0, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd0.rgmii0_rxd0 */
    	{USB1_DRVVBUS, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* usb1_drvvbus.usb1_drvvbus */
    	{USB2_DRVVBUS, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* usb2_drvvbus.usb2_drvvbus */
    	{GPIO6_14, (M0 | PIN_OUTPUT)},	/* gpio6_14.gpio6_14 */
    	{GPIO6_15, (M0 | PIN_OUTPUT)},	/* gpio6_15.gpio6_15 */
    	{GPIO6_16, (M0 | PIN_INPUT_PULLUP)},	/* gpio6_16.gpio6_16 */
    	{XREF_CLK0, (M11 | PIN_INPUT_PULLDOWN)},	/* xref_clk0.pr2_mii1_col */
    	{XREF_CLK1, (M11 | PIN_INPUT_PULLDOWN)},	/* xref_clk1.pr2_mii1_crs */
    	{XREF_CLK2, (M14 | PIN_OUTPUT)},	/* xref_clk2.gpio6_19 */
    	{XREF_CLK3, (M9 | PIN_OUTPUT_PULLDOWN)},	/* xref_clk3.clkout3 */
    	{MCASP1_ACLKX, (M11 | PIN_OUTPUT_PULLDOWN)},	/* mcasp1_aclkx.pr2_mdio_mdclk */
    	{MCASP1_FSX, (M11 | PIN_INPUT | SLEWCONTROL)},	/* mcasp1_fsx.pr2_mdio_data */
    	{MCASP1_ACLKR, (M14 | PIN_INPUT)},	/* mcasp1_aclkr.gpio5_0 */
    	{MCASP1_FSR, (M14 | PIN_INPUT)},	/* mcasp1_fsr.gpio5_1 */
    	{MCASP1_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr0.pr2_mii0_rxer */
    	{MCASP1_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr1.pr2_mii_mt0_clk */
    	{MCASP1_AXR2, (M14 | PIN_INPUT)},	/* mcasp1_axr2.gpio5_4 */
    	{MCASP1_AXR3, (M14 | PIN_INPUT)},	/* mcasp1_axr3.gpio5_5 */
    	{MCASP1_AXR4, (M14 | PIN_OUTPUT)},	/* mcasp1_axr4.gpio5_6 */
    	{MCASP1_AXR5, (M14 | PIN_OUTPUT)},	/* mcasp1_axr5.gpio5_7 */
    	{MCASP1_AXR6, (M14 | PIN_OUTPUT)},	/* mcasp1_axr6.gpio5_8 */
    	{MCASP1_AXR7, (M14 | PIN_OUTPUT)},	/* mcasp1_axr7.gpio5_9 */
    	{MCASP1_AXR8, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr8.pr2_mii0_txen */
    	{MCASP1_AXR9, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr9.pr2_mii0_txd3 */
    	{MCASP1_AXR10, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr10.pr2_mii0_txd2 */
    	{MCASP1_AXR11, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr11.pr2_mii0_txd1 */
    	{MCASP1_AXR12, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr12.pr2_mii0_txd0 */
    	{MCASP1_AXR13, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr13.pr2_mii_mr0_clk */
    	{MCASP1_AXR14, (M11 | PIN_INPUT_SLEW)},	/* mcasp1_axr14.pr2_mii0_rxdv */
    	{MCASP1_AXR15, (M11 | PIN_INPUT_SLEW)},	/* mcasp1_axr15.pr2_mii0_rxd3 */
    	{MCASP2_ACLKX, (M11 | PIN_INPUT_PULLDOWN)},	/* mcasp2_aclkx.pr2_mii0_rxd2 */
    	{MCASP2_FSX, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_fsx.pr2_mii0_rxd1 */
    	{MCASP2_AXR2, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_axr2.pr2_mii0_rxd0 */
    	{MCASP2_AXR3, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_axr3.pr2_mii0_rxlink */
    	{MCASP2_AXR4, (M14 | PIN_OUTPUT)},	/* mcasp2_axr4.gpio1_4 */
    	{MCASP2_AXR5, (M14 | PIN_OUTPUT)},	/* mcasp2_axr5.gpio6_7 */
    	{MCASP2_AXR6, (M14 | PIN_OUTPUT)},	/* mcasp2_axr6.gpio2_29 */
    	{MCASP2_AXR7, (M14 | PIN_OUTPUT)},	/* mcasp2_axr7.gpio1_5 */
    	{MCASP3_ACLKX, (M11 | PIN_INPUT_PULLDOWN)},	/* mcasp3_aclkx.pr2_mii0_crs */
    	{MCASP3_FSX, (M11 | PIN_INPUT_SLEW)},	/* mcasp3_fsx.pr2_mii0_col */
    	{MCASP3_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp3_axr0.pr2_mii1_rxer */
    	{MCASP3_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp3_axr1.pr2_mii1_rxlink */
    	{MCASP4_ACLKX, (M2 | PIN_INPUT)},	/* mcasp4_aclkx.spi3_sclk */
    	{MCASP4_FSX, (M2 | PIN_INPUT)},	/* mcasp4_fsx.spi3_d1 */
    	{MCASP4_AXR1, (M2 | PIN_INPUT_PULLUP)},	/* mcasp4_axr1.spi3_cs0 */
    	{MCASP5_ACLKX, (M13 | PIN_OUTPUT | MANUAL_MODE)},	/* mcasp5_aclkx.pr2_pru1_gpo1 */
    	{MCASP5_FSX, (M12 | PIN_INPUT | MANUAL_MODE)},	/* mcasp5_fsx.pr2_pru1_gpi2 */
    	{MMC1_CLK, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_clk.mmc1_clk */
    	{MMC1_CMD, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_cmd.mmc1_cmd */
    	{MMC1_DAT0, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat0.mmc1_dat0 */
    	{MMC1_DAT1, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat1.mmc1_dat1 */
    	{MMC1_DAT2, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat2.mmc1_dat2 */
    	{MMC1_DAT3, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat3.mmc1_dat3 */
    	{MMC1_SDCD, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdcd.gpio6_27 */
    	{MMC1_SDWP, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdwp.gpio6_28 */
    	{GPIO6_10, (M11 | PIN_INPUT_PULLUP)},	/* gpio6_10.pr2_mii_mt1_clk */
    	{GPIO6_11, (M11 | PIN_OUTPUT_PULLUP)},	/* gpio6_11.pr2_mii1_txen */
    	{MMC3_CLK, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_clk.pr2_mii1_txd3 */
    	{MMC3_CMD, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_cmd.pr2_mii1_txd2 */
    	{MMC3_DAT0, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_dat0.pr2_mii1_txd1 */
    	{MMC3_DAT1, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_dat1.pr2_mii1_txd0 */
    	{MMC3_DAT2, (M11 | PIN_INPUT_PULLUP)},	/* mmc3_dat2.pr2_mii_mr1_clk */
    	{MMC3_DAT3, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat3.pr2_mii1_rxdv */
    	{MMC3_DAT4, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat4.pr2_mii1_rxd3 */
    	{MMC3_DAT5, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat5.pr2_mii1_rxd2 */
    	{MMC3_DAT6, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat6.pr2_mii1_rxd1 */
    	{MMC3_DAT7, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat7.pr2_mii1_rxd0 */
    	{SPI1_SCLK, (M14 | PIN_OUTPUT)},	/* spi1_sclk.gpio7_7 */
    	{SPI1_D1, (M14 | PIN_OUTPUT)},	/* spi1_d1.gpio7_8 */
    	{SPI1_D0, (M14 | PIN_OUTPUT)},	/* spi1_d0.gpio7_9 */
    	{SPI1_CS0, (M14 | PIN_OUTPUT)},	/* spi1_cs0.gpio7_10 */
    	{SPI1_CS1, (M14 | PIN_OUTPUT)},	/* spi1_cs1.gpio7_11 */
    	{SPI1_CS2, (M14 | PIN_INPUT_SLEW)},	/* spi1_cs2.gpio7_12 */
    	{SPI1_CS3, (M6 | PIN_INPUT | SLEWCONTROL)},	/* spi1_cs3.hdmi1_cec */
    	{SPI2_SCLK, (M0 | PIN_INPUT)},	/* spi2_sclk.spi2_sclk */
    	{SPI2_D1, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_d1.spi2_d1 */
    	{SPI2_D0, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_d0.spi2_d0 */
    	{SPI2_CS0, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_cs0.spi2_cs0 */
    	{DCAN1_TX, (M15 | PULL_UP)},	/* dcan1_tx.safe for dcan1_tx */
    	{DCAN1_RX, (M15 | PULL_UP)},	/* dcan1_rx.safe for dcan1_rx */
    	{UART1_RXD, (M14 | PIN_OUTPUT | SLEWCONTROL)},	/* uart1_rxd.gpio7_22 */
    	{UART1_TXD, (M14 | PIN_OUTPUT | SLEWCONTROL)},	/* uart1_txd.gpio7_23 */
    	{UART2_RXD, (M4 | PIN_INPUT)},	/* uart2_rxd.uart2_rxd */
    	{UART2_TXD, (M0 | PIN_OUTPUT)},	/* uart2_txd.uart2_txd */
    	{UART2_CTSN, (M2 | PIN_INPUT)},	/* uart2_ctsn.uart3_rxd */
    	{UART2_RTSN, (M1 | PIN_OUTPUT)},	/* uart2_rtsn.uart3_txd */
    	{I2C1_SDA, (M0 | PIN_INPUT)},	/* i2c1_sda.i2c1_sda */
    	{I2C1_SCL, (M0 | PIN_INPUT)},	/* i2c1_scl.i2c1_scl */
    	{I2C2_SDA, (M1 | PIN_INPUT)},	/* i2c2_sda.hdmi1_ddc_scl */
    	{I2C2_SCL, (M1 | PIN_INPUT)},	/* i2c2_scl.hdmi1_ddc_sda */
    	{WAKEUP0, (M0 | PIN_INPUT)},	/* Wakeup0.Wakeup0 */
    	{WAKEUP1, (M0 | PIN_INPUT)},	/* Wakeup1.Wakeup1 */
    	{WAKEUP2, (M0 | PIN_INPUT)},	/* Wakeup2.Wakeup2 */
    	{WAKEUP3, (M0 | PIN_INPUT)},	/* Wakeup3.Wakeup3 */
    	{ON_OFF, (M0 | PIN_OUTPUT)},	/* on_off.on_off */
    	{RTC_PORZ, (M0 | PIN_INPUT)},	/* rtc_porz.rtc_porz */
    	{TMS, (M0 | PIN_INPUT_PULLUP)},	/* tms.tms */
    	{TDI, (M0 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* tdi.tdi */
    	{TDO, (M0 | PIN_OUTPUT_PULLUP)},	/* tdo.tdo */
    	{TCLK, (M0 | PIN_INPUT_PULLUP)},	/* tclk.tclk */
    	{TRSTN, (M0 | PIN_INPUT_PULLDOWN)},	/* trstn.trstn */
    	{RTCK, (M0 | PIN_OUTPUT_PULLUP)},	/* rtck.rtck */
    	{EMU0, (M0 | PIN_INPUT_PULLUP)},	/* emu0.emu0 */
    	{EMU1, (M0 | PIN_INPUT_PULLUP)},	/* emu1.emu1 */
    	{RESETN, (M0 | PIN_INPUT)},	/* resetn.resetn */
    	{NMIN_DSP, (M0 | PIN_INPUT)},	/* nmin_dsp.nmin_dsp */
    	{RSTOUTN, (M0 | PIN_OUTPUT)},	/* rstoutn.rstoutn */
    };
    
    const struct pad_conf_entry core_padconf_array_essential_am571x_idk[] = {
    	{GPMC_A0, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a0.vin1b_d0 */
    	{GPMC_A1, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a1.vin1b_d1 */
    	{GPMC_A2, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a2.vin1b_d2 */
    	{GPMC_A3, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a3.vin1b_d3 */
    	{GPMC_A4, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a4.vin1b_d4 */
    	{GPMC_A5, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a5.vin1b_d5 */
    	{GPMC_A6, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a6.vin1b_d6 */
    	{GPMC_A7, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a7.vin1b_d7 */
    	{GPMC_A8, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a8.vin1b_hsync1 */
    	{GPMC_A9, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a9.vin1b_vsync1 */
    	{GPMC_A10, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a10.vin1b_clk1 */
    	{GPMC_A11, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a11.vin1b_de1 */
    	{GPMC_A12, (M6 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a12.vin1b_fld1 */
    	{GPMC_A13, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a13.qspi1_rtclk */
    	{GPMC_A14, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a14.qspi1_d3 */
    	{GPMC_A15, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a15.qspi1_d2 */
    	{GPMC_A16, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a16.qspi1_d0 */
    	{GPMC_A17, (M1 | PIN_INPUT | MANUAL_MODE)},	/* gpmc_a17.qspi1_d1 */
    	{GPMC_A18, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_a18.qspi1_sclk */
    	{GPMC_A19, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a19.mmc2_dat4 */
    	{GPMC_A20, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a20.mmc2_dat5 */
    	{GPMC_A21, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a21.mmc2_dat6 */
    	{GPMC_A22, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a22.mmc2_dat7 */
    	{GPMC_A23, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a23.mmc2_clk */
    	{GPMC_A24, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a24.mmc2_dat0 */
    	{GPMC_A25, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a25.mmc2_dat1 */
    	{GPMC_A26, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a26.mmc2_dat2 */
    	{GPMC_A27, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_a27.mmc2_dat3 */
    	{GPMC_CS1, (M1 | PIN_INPUT_PULLUP)},	/* gpmc_cs1.mmc2_cmd */
    	{GPMC_CS0, (M14 | PIN_OUTPUT)},	/* gpmc_cs0.gpio2_19 */
    	{GPMC_CS2, (M1 | PIN_OUTPUT | MANUAL_MODE)},	/* gpmc_cs2.qspi1_cs0 */
    	{GPMC_CS3, (M14 | PIN_OUTPUT)},	/* gpmc_cs3.gpio2_21 */
    	{GPMC_CLK, (M14 | PIN_INPUT)},	/* gpmc_clk.gpio2_22 */
    	{GPMC_ADVN_ALE, (M14 | PIN_OUTPUT)},	/* gpmc_advn_ale.gpio2_23 */
    	{GPMC_OEN_REN, (M14 | PIN_OUTPUT)},	/* gpmc_oen_ren.gpio2_24 */
    	{GPMC_WEN, (M14 | PIN_OUTPUT)},	/* gpmc_wen.gpio2_25 */
    	{GPMC_BEN0, (M14 | PIN_OUTPUT)},	/* gpmc_ben0.gpio2_26 */
    	{GPMC_BEN1, (M14 | PIN_OUTPUT)},	/* gpmc_ben1.gpio2_27 */
    	{GPMC_WAIT0, (M14 | PIN_OUTPUT | SLEWCONTROL)},	/* gpmc_wait0.gpio2_28 */
    	{VIN2A_CLK0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_clk0.gpio3_28 */
    	{VIN2A_DE0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_de0.gpio3_29 */
    	{VIN2A_FLD0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_fld0.gpio3_30 */
    	{VIN2A_HSYNC0, (M14 | PIN_INPUT_PULLUP)},	/* vin2a_hsync0.gpio3_31 */
    	{VIN2A_VSYNC0, (M14 | PIN_OUTPUT)},	/* vin2a_vsync0.gpio4_0 */
    	{VIN2A_D0, (M11 | PIN_INPUT)},	/* vin2a_d0.pr1_uart0_rxd */
    	{VIN2A_D1, (M11 | PIN_OUTPUT)},	/* vin2a_d1.pr1_uart0_txd */
    	{VIN2A_D2, (M10 | PIN_OUTPUT)},	/* vin2a_d2.eCAP1_in_PWM1_out */
    	{VIN2A_D10, (M11 | PIN_OUTPUT_PULLDOWN)},	/* vin2a_d10.pr1_mdio_mdclk */
    	{VIN2A_D11, (M11 | PIN_INPUT)},	/* vin2a_d11.pr1_mdio_data */
    	{VIN2A_D12, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d12.rgmii1_txc */
    	{VIN2A_D13, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d13.rgmii1_txctl */
    	{VIN2A_D14, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d14.rgmii1_txd3 */
    	{VIN2A_D15, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d15.rgmii1_txd2 */
    	{VIN2A_D16, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d16.rgmii1_txd1 */
    	{VIN2A_D17, (M3 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d17.rgmii1_txd0 */
    	{VIN2A_D18, (M3 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d18.rgmii1_rxc */
    	{VIN2A_D19, (M3 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d19.rgmii1_rxctl */
    	{VIN2A_D20, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d20.rgmii1_rxd3 */
    	{VIN2A_D21, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d21.rgmii1_rxd2 */
    	{VIN2A_D22, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d22.rgmii1_rxd1 */
    	{VIN2A_D23, (M3 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* vin2a_d23.rgmii1_rxd0 */
    	{VOUT1_FLD, (M14 | PIN_OUTPUT)},	/* vout1_fld.gpio4_21 */
    	{MDIO_MCLK, (M0 | PIN_OUTPUT_PULLDOWN | SLEWCONTROL)},	/* mdio_mclk.mdio_mclk */
    	{MDIO_D, (M0 | PIN_INPUT | SLEWCONTROL)},	/* mdio_d.mdio_d */
    	{UART3_RXD, (M14 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* uart3_rxd.gpio5_18 */
    	{UART3_TXD, (M14 | PIN_OUTPUT_PULLDOWN | SLEWCONTROL)},	/* uart3_txd.gpio5_19 */
    	{RGMII0_TXC, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txc.rgmii0_txc */
    	{RGMII0_TXCTL, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txctl.rgmii0_txctl */
    	{RGMII0_TXD3, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd3.rgmii0_txd3 */
    	{RGMII0_TXD2, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd2.rgmii0_txd2 */
    	{RGMII0_TXD1, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd1.rgmii0_txd1 */
    	{RGMII0_TXD0, (M0 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_txd0.rgmii0_txd0 */
    	{RGMII0_RXC, (M0 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_rxc.rgmii0_rxc */
    	{RGMII0_RXCTL, (M0 | PIN_INPUT_PULLDOWN | MANUAL_MODE)},	/* rgmii0_rxctl.rgmii0_rxctl */
    	{RGMII0_RXD3, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd3.rgmii0_rxd3 */
    	{RGMII0_RXD2, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd2.rgmii0_rxd2 */
    	{RGMII0_RXD1, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd1.rgmii0_rxd1 */
    	{RGMII0_RXD0, (M0 | PIN_INPUT_PULLUP | MANUAL_MODE)},	/* rgmii0_rxd0.rgmii0_rxd0 */
    	{USB1_DRVVBUS, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* usb1_drvvbus.usb1_drvvbus */
    	{USB2_DRVVBUS, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* usb2_drvvbus.usb2_drvvbus */
    	{GPIO6_14, (M0 | PIN_OUTPUT)},	/* gpio6_14.gpio6_14 */
    	{GPIO6_15, (M0 | PIN_OUTPUT)},	/* gpio6_15.gpio6_15 */
    	{GPIO6_16, (M0 | PIN_INPUT_PULLUP)},	/* gpio6_16.gpio6_16 */
    	{XREF_CLK0, (M11 | PIN_INPUT_PULLDOWN)},	/* xref_clk0.pr2_mii1_col */
    	{XREF_CLK1, (M11 | PIN_INPUT_PULLDOWN)},	/* xref_clk1.pr2_mii1_crs */
    	{XREF_CLK2, (M14 | PIN_OUTPUT)},	/* xref_clk2.gpio6_19 */
    	{XREF_CLK3, (M7 | PIN_INPUT)},	/* xref_clk3.hdq0 */
    	{MCASP1_ACLKX, (M11 | PIN_OUTPUT_PULLDOWN)},	/* mcasp1_aclkx.pr2_mdio_mdclk */
    	{MCASP1_FSX, (M11 | PIN_INPUT | SLEWCONTROL)},	/* mcasp1_fsx.pr2_mdio_data */
    	{MCASP1_ACLKR, (M14 | PIN_INPUT)},	/* mcasp1_aclkr.gpio5_0 */
    	{MCASP1_FSR, (M14 | PIN_INPUT)},	/* mcasp1_fsr.gpio5_1 */
    	{MCASP1_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr0.pr2_mii0_rxer */
    	{MCASP1_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr1.pr2_mii_mt0_clk */
    	{MCASP1_AXR2, (M14 | PIN_INPUT)},	/* mcasp1_axr2.gpio5_4 */
    	{MCASP1_AXR3, (M14 | PIN_INPUT)},	/* mcasp1_axr3.gpio5_5 */
    	{MCASP1_AXR4, (M14 | PIN_INPUT_PULLDOWN)},	/* mcasp1_axr4.gpio5_6 */
    	{MCASP1_AXR5, (M14 | PIN_INPUT)},	/* mcasp1_axr5.gpio5_7 */
    	{MCASP1_AXR6, (M14 | PIN_OUTPUT)},	/* mcasp1_axr6.gpio5_8 */
    	{MCASP1_AXR7, (M14 | PIN_OUTPUT)},	/* mcasp1_axr7.gpio5_9 */
    	{MCASP1_AXR8, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr8.pr2_mii0_txen */
    	{MCASP1_AXR9, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr9.pr2_mii0_txd3 */
    	{MCASP1_AXR10, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr10.pr2_mii0_txd2 */
    	{MCASP1_AXR11, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr11.pr2_mii0_txd1 */
    	{MCASP1_AXR12, (M11 | PIN_OUTPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr12.pr2_mii0_txd0 */
    	{MCASP1_AXR13, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp1_axr13.pr2_mii_mr0_clk */
    	{MCASP1_AXR14, (M11 | PIN_INPUT_SLEW)},	/* mcasp1_axr14.pr2_mii0_rxdv */
    	{MCASP1_AXR15, (M11 | PIN_INPUT_SLEW)},	/* mcasp1_axr15.pr2_mii0_rxd3 */
    	{MCASP2_ACLKX, (M11 | PIN_INPUT_PULLDOWN)},	/* mcasp2_aclkx.pr2_mii0_rxd2 */
    	{MCASP2_FSX, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_fsx.pr2_mii0_rxd1 */
    	{MCASP2_AXR2, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_axr2.pr2_mii0_rxd0 */
    	{MCASP2_AXR3, (M11 | PIN_INPUT_SLEW)},	/* mcasp2_axr3.pr2_mii0_rxlink */
    	{MCASP2_AXR4, (M14 | PIN_OUTPUT)},	/* mcasp2_axr4.gpio1_4 */
    	{MCASP2_AXR5, (M14 | PIN_OUTPUT)},	/* mcasp2_axr5.gpio6_7 */
    	{MCASP2_AXR6, (M14 | PIN_OUTPUT)},	/* mcasp2_axr6.gpio2_29 */
    	{MCASP2_AXR7, (M14 | PIN_OUTPUT)},	/* mcasp2_axr7.gpio1_5 */
    	{MCASP3_ACLKX, (M11 | PIN_INPUT_PULLDOWN)},	/* mcasp3_aclkx.pr2_mii0_crs */
    	{MCASP3_FSX, (M11 | PIN_INPUT_SLEW)},	/* mcasp3_fsx.pr2_mii0_col */
    	{MCASP3_AXR0, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp3_axr0.pr2_mii1_rxer */
    	{MCASP3_AXR1, (M11 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* mcasp3_axr1.pr2_mii1_rxlink */
    	{MCASP4_ACLKX, (M2 | PIN_OUTPUT)},	/* mcasp4_aclkx.spi3_sclk */
    	{MCASP4_FSX, (M2 | PIN_INPUT)},	/* mcasp4_fsx.spi3_d1 */
    	{MCASP4_AXR1, (M2 | PIN_OUTPUT_PULLUP)},	/* mcasp4_axr1.spi3_cs0 */
    	{MCASP5_AXR0, (M4 | PIN_INPUT)},	/* mcasp5_axr0.uart3_rxd */
    	{MCASP5_AXR1, (M4 | PIN_OUTPUT)},	/* mcasp5_axr1.uart3_txd */
    	{MMC1_CLK, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_clk.mmc1_clk */
    	{MMC1_CMD, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_cmd.mmc1_cmd */
    	{MMC1_DAT0, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat0.mmc1_dat0 */
    	{MMC1_DAT1, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat1.mmc1_dat1 */
    	{MMC1_DAT2, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat2.mmc1_dat2 */
    	{MMC1_DAT3, (M0 | PIN_INPUT_PULLUP)},	/* mmc1_dat3.mmc1_dat3 */
    	{MMC1_SDCD, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdcd.gpio6_27 */
    	{MMC1_SDWP, (M14 | PIN_INPUT | SLEWCONTROL)},	/* mmc1_sdwp.gpio6_28 */
    	{GPIO6_10, (M11 | PIN_INPUT_PULLUP)},	/* gpio6_10.pr2_mii_mt1_clk */
    	{GPIO6_11, (M11 | PIN_OUTPUT_PULLUP)},	/* gpio6_11.pr2_mii1_txen */
    	{MMC3_CLK, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_clk.pr2_mii1_txd3 */
    	{MMC3_CMD, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_cmd.pr2_mii1_txd2 */
    	{MMC3_DAT0, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_dat0.pr2_mii1_txd1 */
    	{MMC3_DAT1, (M11 | PIN_OUTPUT_PULLUP)},	/* mmc3_dat1.pr2_mii1_txd0 */
    	{MMC3_DAT2, (M11 | PIN_INPUT_PULLUP)},	/* mmc3_dat2.pr2_mii_mr1_clk */
    	{MMC3_DAT3, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat3.pr2_mii1_rxdv */
    	{MMC3_DAT4, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat4.pr2_mii1_rxd3 */
    	{MMC3_DAT5, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat5.pr2_mii1_rxd2 */
    	{MMC3_DAT6, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat6.pr2_mii1_rxd1 */
    	{MMC3_DAT7, (M11 | PIN_INPUT_PULLDOWN)},	/* mmc3_dat7.pr2_mii1_rxd0 */
    	{SPI1_SCLK, (M14 | PIN_OUTPUT)},	/* spi1_sclk.gpio7_7 */
    	{SPI1_D1, (M14 | PIN_OUTPUT)},	/* spi1_d1.gpio7_8 */
    	{SPI1_D0, (M14 | PIN_OUTPUT)},	/* spi1_d0.gpio7_9 */
    	{SPI1_CS0, (M14 | PIN_OUTPUT)},	/* spi1_cs0.gpio7_10 */
    	{SPI1_CS1, (M14 | PIN_OUTPUT)},	/* spi1_cs1.gpio7_11 */
    	{SPI1_CS2, (M14 | PIN_INPUT_SLEW)},	/* spi1_cs2.gpio7_12 */
    	{SPI1_CS3, (M6 | PIN_INPUT | SLEWCONTROL)},	/* spi1_cs3.hdmi1_cec */
    	{SPI2_SCLK, (M0 | PIN_INPUT)},	/* spi2_sclk.spi2_sclk */
    	{SPI2_D1, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_d1.spi2_d1 */
    	{SPI2_D0, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_d0.spi2_d0 */
    	{SPI2_CS0, (M0 | PIN_INPUT | SLEWCONTROL)},	/* spi2_cs0.spi2_cs0 */
    	{DCAN1_TX, (M15 | PULL_UP)},	/* dcan1_tx.safe for dcan1_tx */
    	{DCAN1_RX, (M15 | PULL_UP)},	/* dcan1_rx.safe for dcan1_rx */
    	{UART1_RXD, (M14 | PIN_INPUT | SLEWCONTROL)},	/* uart1_rxd.gpio7_22 */
    	{UART1_CTSN, (M14 | PIN_OUTPUT)},	/* uart1_ctsn.gpio7_24 */
    	{UART1_RTSN, (M14 | PIN_OUTPUT)},	/* uart1_rtsn.gpio7_25 */
    	{I2C1_SDA, (M0 | PIN_INPUT)},	/* i2c1_sda.i2c1_sda */
    	{I2C1_SCL, (M0 | PIN_INPUT)},	/* i2c1_scl.i2c1_scl */
    	{I2C2_SDA, (M1 | PIN_INPUT)},	/* i2c2_sda.hdmi1_ddc_scl */
    	{I2C2_SCL, (M1 | PIN_INPUT)},	/* i2c2_scl.hdmi1_ddc_sda */
    	{WAKEUP0, (M0 | PIN_INPUT)},	/* Wakeup0.Wakeup0 */
    	{WAKEUP3, (M0 | PIN_INPUT)},	/* Wakeup3.Wakeup3 */
    	{ON_OFF, (M0 | PIN_OUTPUT)},	/* on_off.on_off */
    	{RTC_PORZ, (M0 | PIN_INPUT)},	/* rtc_porz.rtc_porz */
    	{TMS, (M0 | PIN_INPUT_PULLUP)},	/* tms.tms */
    	{TDI, (M0 | PIN_INPUT_PULLUP | SLEWCONTROL)},	/* tdi.tdi */
    	{TDO, (M0 | PIN_OUTPUT_PULLUP)},	/* tdo.tdo */
    	{TCLK, (M0 | PIN_INPUT_PULLUP)},	/* tclk.tclk */
    	{TRSTN, (M0 | PIN_INPUT)},	/* trstn.trstn */
    	{RTCK, (M0 | PIN_OUTPUT_PULLUP)},	/* rtck.rtck */
    	{EMU0, (M0 | PIN_INPUT)},	/* emu0.emu0 */
    	{EMU1, (M0 | PIN_INPUT)},	/* emu1.emu1 */
    	{RESETN, (M0 | PIN_INPUT)},	/* resetn.resetn */
    	{RSTOUTN, (M0 | PIN_OUTPUT)},	/* rstoutn.rstoutn */
    };
    
    const struct pad_conf_entry core_padconf_array_icss1eth_am571x_idk[] = {
    	/* PR1 MII0 */
    	{VOUT1_D8, (M12 | PIN_INPUT_PULLUP)},	/* vout1_d8.pr1_mii_mt0_clk */
    	{VOUT1_D9, (M13 | PIN_OUTPUT_PULLUP)},	/* vout1_d9.pr1_mii0_txd3 */
    	{VOUT1_D10, (M13 | PIN_OUTPUT_PULLUP)},	/* vout1_d10.pr1_mii0_txd2 */
    	{VOUT1_D11, (M13 | PIN_OUTPUT_PULLUP)},	/* vout1_d11.pr1_mii0_txen */
    	{VOUT1_D12, (M13 | PIN_OUTPUT_PULLUP)},	/* vout1_d12.pr1_mii0_txd1 */
    	{VOUT1_D13, (M13 | PIN_OUTPUT_PULLUP)},	/* vout1_d13.pr1_mii0_txd0 */
    	{VOUT1_D14, (M12 | PIN_INPUT_PULLUP)},	/* vout1_d14.pr1_mii_mr0_clk */
    	{VOUT1_D15, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d15.pr1_mii0_rxdv */
    	{VOUT1_D16, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d16.pr1_mii0_rxd3 */
    	{VOUT1_D17, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d17.pr1_mii0_rxd2 */
    	{VOUT1_D18, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d18.pr1_mii0_rxd1 */
    	{VOUT1_D19, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d19.pr1_mii0_rxd0 */
    	{VOUT1_D20, (M12 | PIN_INPUT_PULLUP)},	/* vout1_d20.pr1_mii0_rxer */
    	{VOUT1_D21, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d21.pr1_mii0_rxlink */
    	{VOUT1_D22, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d22.pr1_mii0_col */
    	{VOUT1_D23, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d23.pr1_mii0_crs */
    
    	/* PR1 MII1 */
    	{VIN2A_D3, (M12 | PIN_INPUT_PULLDOWN)},	/* vin2a_d3.pr1_mii1_col */
    	{VIN2A_D4, (M13 | PIN_OUTPUT_PULLUP)},	/* vin2a_d4.pr1_mii1_txd1 */
    	{VIN2A_D5, (M13 | PIN_OUTPUT_PULLUP)},	/* vin2a_d5.pr1_mii1_txd0 */
    	{VIN2A_D6, (M11 | PIN_INPUT_PULLUP)},	/* vin2a_d6.pr1_mii_mt1_clk */
    	{VIN2A_D7, (M11 | PIN_OUTPUT_PULLUP)},	/* vin2a_d7.pr1_mii1_txen */
    	{VIN2A_D8, (M11 | PIN_OUTPUT_PULLUP)},	/* vin2a_d8.pr1_mii1_txd3 */
    	{VIN2A_D9, (M11 | PIN_OUTPUT_PULLUP)},	/* vin2a_d9.pr1_mii1_txd2 */
    	{VOUT1_VSYNC, (M12 | PIN_INPUT_PULLUP)},	/* vout1_vsync.pr1_mii1_rxer */
    	{VOUT1_D0, (M12 | PIN_INPUT_PULLUP)},	/* vout1_d0.pr1_mii1_rxlink */
    	{VOUT1_D1, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d1.pr1_mii1_crs */
    	{VOUT1_D2, (M12 | PIN_INPUT_PULLUP)},	/* vout1_d2.pr1_mii_mr1_clk */
    	{VOUT1_D3, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d3.pr1_mii1_rxdv */
    	{VOUT1_D4, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d4.pr1_mii1_rxd3 */
    	{VOUT1_D5, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d5.pr1_mii1_rxd2 */
    	{VOUT1_D6, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d6.pr1_mii1_rxd1 */
    	{VOUT1_D7, (M12 | PIN_INPUT_PULLDOWN)},	/* vout1_d7.pr1_mii1_rxd0 */
    };
    
    const struct pad_conf_entry core_padconf_array_vout_am571x_idk[] = {
    	{VOUT1_CLK, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_clk.vout1_clk */
    	{VOUT1_DE, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_de.vout1_de */
    	{VOUT1_HSYNC, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_hsync.vout1_hsync */
    	{VOUT1_VSYNC, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_vsync.vout1_vsync */
    	{VOUT1_D0, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d0.vout1_d0 */
    	{VOUT1_D1, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d1.vout1_d1 */
    	{VOUT1_D2, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d2.vout1_d2 */
    	{VOUT1_D3, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d3.vout1_d3 */
    	{VOUT1_D4, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d4.vout1_d4 */
    	{VOUT1_D5, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d5.vout1_d5 */
    	{VOUT1_D6, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d6.vout1_d6 */
    	{VOUT1_D7, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d7.vout1_d7 */
    	{VOUT1_D8, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d8.vout1_d8 */
    	{VOUT1_D9, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d9.vout1_d9 */
    	{VOUT1_D10, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d10.vout1_d10 */
    	{VOUT1_D11, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d11.vout1_d11 */
    	{VOUT1_D12, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d12.vout1_d12 */
    	{VOUT1_D13, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d13.vout1_d13 */
    	{VOUT1_D14, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d14.vout1_d14 */
    	{VOUT1_D15, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d15.vout1_d15 */
    	{VOUT1_D16, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d16.vout1_d16 */
    	{VOUT1_D17, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d17.vout1_d17 */
    	{VOUT1_D18, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d18.vout1_d18 */
    	{VOUT1_D19, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d19.vout1_d19 */
    	{VOUT1_D20, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d20.vout1_d20 */
    	{VOUT1_D21, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d21.vout1_d21 */
    	{VOUT1_D22, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d22.vout1_d22 */
    	{VOUT1_D23, (M0 | PIN_OUTPUT | SLEWCONTROL)},	/* vout1_d23.vout1_d23 */
    
    	{MCASP5_ACLKX, (M12 | PIN_INPUT | MANUAL_MODE)},	/* mcasp5_aclkx.pr2_pru1_gpi1 */
    	{MCASP5_FSX, (M12 | PIN_INPUT | MANUAL_MODE)},	/* mcasp5_fsx.pr2_pru1_gpi2 */
    	{UART2_RXD, (M0 | PIN_INPUT)},	/* uart2_rxd.uart2_rxd */
    	{UART2_TXD, (M0 | PIN_OUTPUT)},	/* uart2_txd.uart2_txd */
    	{VIN2A_D5, (M13 | PIN_OUTPUT_PULLDOWN | MANUAL_MODE)},	/* vin2a_d5.pr1_pru1_gpo2 */
    };
    
    const struct pad_conf_entry early_padconf[] = {
    	{UART2_CTSN, (M2 | PIN_INPUT_SLEW)},	/* uart2_ctsn.uart3_rxd */
    	{UART2_RTSN, (M1 | PIN_INPUT_SLEW)},	/* uart2_rtsn.uart3_txd */
    	{I2C1_SDA, (PIN_INPUT_PULLUP | M0)},	/* I2C1_SDA */
    	{I2C1_SCL, (PIN_INPUT_PULLUP | M0)},	/* I2C1_SCL */
    };
    
    #ifdef CONFIG_IODELAY_RECALIBRATION
    const struct iodelay_cfg_entry iodelay_cfg_array_x15_sr1_1[] = {
    	{0x0114, 2980, 0},	/* CFG_GPMC_A0_IN */
    	{0x0120, 2648, 0},	/* CFG_GPMC_A10_IN */
    	{0x012C, 2918, 0},	/* CFG_GPMC_A11_IN */
    	{0x0198, 2917, 0},	/* CFG_GPMC_A1_IN */
    	{0x0204, 3156, 178},	/* CFG_GPMC_A2_IN */
    	{0x0210, 3109, 246},	/* CFG_GPMC_A3_IN */
    	{0x021C, 3142, 100},	/* CFG_GPMC_A4_IN */
    	{0x0228, 3084, 33},	/* CFG_GPMC_A5_IN */
    	{0x0234, 2778, 0},	/* CFG_GPMC_A6_IN */
    	{0x0240, 3110, 0},	/* CFG_GPMC_A7_IN */
    	{0x024C, 2874, 0},	/* CFG_GPMC_A8_IN */
    	{0x0258, 3072, 0},	/* CFG_GPMC_A9_IN */
    	{0x0264, 2466, 0},	/* CFG_GPMC_AD0_IN */
    	{0x0270, 2523, 0},	/* CFG_GPMC_AD10_IN */
    	{0x027C, 2453, 0},	/* CFG_GPMC_AD11_IN */
    	{0x0288, 2285, 0},	/* CFG_GPMC_AD12_IN */
    	{0x0294, 2206, 0},	/* CFG_GPMC_AD13_IN */
    	{0x02A0, 1898, 0},	/* CFG_GPMC_AD14_IN */
    	{0x02AC, 2473, 0},	/* CFG_GPMC_AD15_IN */
    	{0x02B8, 2307, 0},	/* CFG_GPMC_AD1_IN */
    	{0x02C4, 2691, 0},	/* CFG_GPMC_AD2_IN */
    	{0x02D0, 2384, 0},	/* CFG_GPMC_AD3_IN */
    	{0x02DC, 2462, 0},	/* CFG_GPMC_AD4_IN */
    	{0x02E8, 2335, 0},	/* CFG_GPMC_AD5_IN */
    	{0x02F4, 2370, 0},	/* CFG_GPMC_AD6_IN */
    	{0x0300, 2389, 0},	/* CFG_GPMC_AD7_IN */
    	{0x030C, 2672, 0},	/* CFG_GPMC_AD8_IN */
    	{0x0318, 2334, 0},	/* CFG_GPMC_AD9_IN */
    //caravel
    	{0x0144, 0, 0},		/* CFG_GPMC_A13_IN */
    	{0x0150, 2575, 966},	/* CFG_GPMC_A14_IN */
    	{0x015C, 2503, 889},	/* CFG_GPMC_A15_IN */
    	{0x0168, 2528, 1007},	/* CFG_GPMC_A16_IN */
    	{0x0170, 0, 0},		/* CFG_GPMC_A16_OUT */
    	{0x0174, 2533, 980},	/* CFG_GPMC_A17_IN */
    	{0x0188, 590, 0},	/* CFG_GPMC_A18_OUT */
    	{0x0374, 0, 0},		/* CFG_GPMC_CS2_OUT */
    
    	{0x0378, 0, 0},		/* CFG_GPMC_CS3_IN */
    	{0x0678, 406, 0},	/* CFG_MMC3_CLK_IN */
    //caravel
    	{0x03D4, 2533, 980},	/* CFG_MCASP1_AXR10_OUT*/
    	{0x03E0, 0, 0},		/* CFG_MCASP1_AXR11_OUT*/
    	{0x0470, 590, 0},	/* CFG_MCASP1_AXR8_OUT*/
    	{0x0474, 2528, 1007},	/* CFG_MCASP1_AXR9_IN*/
    
    	{0x0680, 659, 0},	/* CFG_MMC3_CLK_OUT */
    	{0x0684, 0, 0},	/* CFG_MMC3_CMD_IN */
    	{0x0688, 0, 0},	/* CFG_MMC3_CMD_OEN */
    	{0x068C, 0, 0},	/* CFG_MMC3_CMD_OUT */
    	{0x0690, 130, 0},	/* CFG_MMC3_DAT0_IN */
    	{0x0694, 0, 0},	/* CFG_MMC3_DAT0_OEN */
    	{0x0698, 0, 0},	/* CFG_MMC3_DAT0_OUT */
    	{0x069C, 169, 0},	/* CFG_MMC3_DAT1_IN */
    	{0x06A0, 0, 0},	/* CFG_MMC3_DAT1_OEN */
    	{0x06A4, 0, 0},	/* CFG_MMC3_DAT1_OUT */
    	{0x06A8, 0, 0},	/* CFG_MMC3_DAT2_IN */
    	{0x06AC, 0, 0},	/* CFG_MMC3_DAT2_OEN */
    	{0x06B0, 0, 0},	/* CFG_MMC3_DAT2_OUT */
    	{0x06B4, 457, 0},	/* CFG_MMC3_DAT3_IN */
    	{0x06B8, 0, 0},	/* CFG_MMC3_DAT3_OEN */
    	{0x06BC, 0, 0},	/* CFG_MMC3_DAT3_OUT */
    	{0x06C0, 702, 0},	/* CFG_MMC3_DAT4_IN */
    	{0x06C4, 0, 0},	/* CFG_MMC3_DAT4_OEN */
    	{0x06C8, 0, 0},	/* CFG_MMC3_DAT4_OUT */
    	{0x06CC, 738, 0},	/* CFG_MMC3_DAT5_IN */
    	{0x06D0, 0, 0},	/* CFG_MMC3_DAT5_OEN */
    	{0x06D4, 0, 0},	/* CFG_MMC3_DAT5_OUT */
    	{0x06D8, 856, 0},	/* CFG_MMC3_DAT6_IN */
    	{0x06DC, 0, 0},	/* CFG_MMC3_DAT6_OEN */
    	{0x06E0, 0, 0},	/* CFG_MMC3_DAT6_OUT */
    	{0x06E4, 610, 0},	/* CFG_MMC3_DAT7_IN */
    	{0x06E8, 0, 0},	/* CFG_MMC3_DAT7_OEN */
    	{0x06EC, 0, 0},	/* CFG_MMC3_DAT7_OUT */
    	{0x06F0, 480, 0},	/* CFG_RGMII0_RXC_IN */
    	{0x06FC, 111, 1641},	/* CFG_RGMII0_RXCTL_IN */
    	{0x0708, 272, 1116},	/* CFG_RGMII0_RXD0_IN */
    	{0x0714, 243, 1260},	/* CFG_RGMII0_RXD1_IN */
    	{0x0720, 0, 1614},	/* CFG_RGMII0_RXD2_IN */
    	{0x072C, 105, 1673},	/* CFG_RGMII0_RXD3_IN */
    	{0x0740, 531, 120},	/* CFG_RGMII0_TXC_OUT */
    	{0x074C, 201, 60},	/* CFG_RGMII0_TXCTL_OUT */
    	{0x0758, 229, 120},	/* CFG_RGMII0_TXD0_OUT */
    	{0x0764, 141, 0},	/* CFG_RGMII0_TXD1_OUT */
    	{0x0770, 495, 120},	/* CFG_RGMII0_TXD2_OUT */
    	{0x077C, 660, 120},	/* CFG_RGMII0_TXD3_OUT */
    	{0x0A70, 1551, 115},	/* CFG_VIN2A_D12_OUT */
    	{0x0A7C, 816, 0},	/* CFG_VIN2A_D13_OUT */
    	{0x0A88, 876, 0},	/* CFG_VIN2A_D14_OUT */
    	{0x0A94, 312, 0},	/* CFG_VIN2A_D15_OUT */
    	{0x0AA0, 58, 0},	/* CFG_VIN2A_D16_OUT */
    	{0x0AAC, 0, 0},	/* CFG_VIN2A_D17_OUT */
    	{0x0AB0, 702, 0},	/* CFG_VIN2A_D18_IN */
    	{0x0ABC, 136, 976},	/* CFG_VIN2A_D19_IN */
    	{0x0AD4, 210, 1357},	/* CFG_VIN2A_D20_IN */
    	{0x0AE0, 189, 1462},	/* CFG_VIN2A_D21_IN */
    	{0x0AEC, 232, 1278},	/* CFG_VIN2A_D22_IN */
    	{0x0AF8, 0, 1397},	/* CFG_VIN2A_D23_IN */
    //caravel
    	{0x0CC0, 2688, 0},	/* CFG_VIN3A_DE_OUT */
    	{0x0CD8, 2420, 0},	/* CFG_VIN3A_HSYNC_OUT */
    	{0x0CE4, 2274, 0},	/* CFG_VIN3A_VSYNC_OUT */
    	{0x0B94, 0, 0},		/* CFG_VIN3A_CLK_OUT */
    	{0x0C00, 3033, 0},	/* CFG_VIN3A_D17_OUT */
    	{0x0C0C, 2780, 0},	/* CFG_VIN3A_D18_OUT */
    	{0x0C18, 2442, 0},	/* CFG_VIN3A_D19_OUT */
    	{0x0C30, 2955, 120},	/* CFG_VIN3A_D20_OUT */
    	{0x0C3C, 2572, 0},	/* CFG_VIN3A_D21_OUT */
    	{0x0C48, 2761, 0},	/* CFG_VIN3A_D22_OUT */
    	{0x0C54, 2674, 0},	/* CFG_VIN3A_D23_OUT */
    	{0x0CA8, 2970, 69},	/* CFG_VIN3A_D8_OUT */
    	{0x0CB4, 2992, 80},	/* CFG_VIN3A_D9_OUT */
    	{0x0BAC, 2924, 5},	/* CFG_VIN3A_D10_OUT */
    	{0x0BB8, 2993, 56},	/* CFG_VIN3A_D11_OUT */
    	{0x0BC4, 2944, 0},	/* CFG_VIN3A_D12_OUT */
    	{0x0BD0, 2916, 0},	/* CFG_VIN3A_D13_OUT */
    	{0x0BDC, 2917, 0},	/* CFG_VIN3A_D14_OUT */
    	{0x0BE8, 3013, 0},	/* CFG_VIN3A_D15_OUT */
    	
    //	{0x0BF4, 1996, 0},	/* CFG_VIN3A_D16_OUT */
    //	{0x0C24, 2439, 0},	/* CFG_VIN3A_D1_OUT */
    //	{0x0BA0, 2313, 0},	/* CFG_VIN3A_D0_OUT */
    //	{0x0C60, 2200, 0},	/* CFG_VIN3A_D2_OUT */
    //	{0x0C6C, 2355, 0},	/* CFG_VIN3A_D3_OUT */
    //	{0x0C78, 3215, 0},	/* CFG_VIN3A_D4_OUT */
    //	{0x0C84, 2314, 0},	/* CFG_VIN3A_D5_OUT */
    //	{0x0C90, 2238, 0},	/* CFG_VIN3A_D6_OUT */
    //	{0x0C9C, 2381, 0},	/* CFG_VIN3A_D7_OUT */
    
    //	{0x0B9C, 0, 706},	/* CFG_VIN3A_CLK_OUT */
    //	{0x0BA8, 2313, 0},	/* CFG_VIN3A_D0_OUT */
    //	{0x0BB4, 2199, 0},	/* CFG_VIN3A_D10_OUT */
    //	{0x0BC0, 2266, 0},	/* CFG_VIN3A_D11_OUT */
    //	{0x0BCC, 3159, 0},	/* CFG_VIN3A_D12_OUT */
    //	{0x0BD8, 2100, 0},	/* CFG_VIN3A_D13_OUT */
    //	{0x0BE4, 2229, 0},	/* CFG_VIN3A_D14_OUT */
    //	{0x0BF0, 2202, 0},	/* CFG_VIN3A_D15_OUT */
    //	{0x0BFC, 2084, 0},	/* CFG_VIN3A_D16_OUT */
    //	{0x0C08, 2195, 0},	/* CFG_VIN3A_D17_OUT */
    //	{0x0C14, 2342, 0},	/* CFG_VIN3A_D18_OUT */
    //	{0x0C20, 2463, 0},	/* CFG_VIN3A_D19_OUT */
    //	{0x0C2C, 2439, 0},	/* CFG_VIN3A_D1_OUT */
    //	{0x0C38, 2304, 0},	/* CFG_VIN3A_D20_OUT */
    //	{0x0C44, 2103, 0},	/* CFG_VIN3A_D21_OUT */
    //	{0x0C50, 2145, 0},	/* CFG_VIN3A_D22_OUT */
    //	{0x0C5C, 1932, 0},	/* CFG_VIN3A_D23_OUT */
    //	{0x0C68, 2200, 0},	/* CFG_VIN3A_D2_OUT */
    //	{0x0C74, 2355, 0},	/* CFG_VIN3A_D3_OUT */
    //	{0x0C80, 3215, 0},	/* CFG_VIN3A_D4_OUT */
    //	{0x0C8C, 2314, 0},	/* CFG_VIN3A_D5_OUT */
    //	{0x0C98, 2238, 0},	/* CFG_VIN3A_D6_OUT */
    //	{0x0CA4, 2381, 0},	/* CFG_VIN3A_D7_OUT */
    //	{0x0CB0, 2138, 0},	/* CFG_VIN3A_D8_OUT */
    //	{0x0CBC, 2383, 0},	/* CFG_VIN3A_D9_OUT */
    //	{0x0CC8, 1984, 0},	/* CFG_VIN3A_DE_OUT */
    //	{0x0CE0, 1947, 0},	/* CFG_VIN3A_HSYNC_OUT */
    //	{0x0CEC, 2739, 0},	/* CFG_VIN3A_VSYNC_OUT */
    };
    
    const struct iodelay_cfg_entry iodelay_cfg_array_x15_sr2_0[] = {
    	{0x0114, 2519, 702},	/* CFG_GPMC_A0_IN */
    	{0x0120, 2435, 411},	/* CFG_GPMC_A10_IN */
    	{0x012C, 2379, 755},	/* CFG_GPMC_A11_IN */
    	{0x0198, 2384, 778},	/* CFG_GPMC_A1_IN */
    	{0x0204, 2499, 1127},	/* CFG_GPMC_A2_IN */
    	{0x0210, 2455, 1181},	/* CFG_GPMC_A3_IN */
    	{0x021C, 2486, 1039},	/* CFG_GPMC_A4_IN */
    	{0x0228, 2456, 938},	/* CFG_GPMC_A5_IN */
    	{0x0234, 2463, 573},	/* CFG_GPMC_A6_IN */
    	{0x0240, 2608, 783},	/* CFG_GPMC_A7_IN */
    	{0x024C, 2430, 656},	/* CFG_GPMC_A8_IN */
    	{0x0258, 2465, 850},	/* CFG_GPMC_A9_IN */
    	{0x0264, 2316, 301},	/* CFG_GPMC_AD0_IN */
    	{0x0270, 2324, 406},	/* CFG_GPMC_AD10_IN */
    	{0x027C, 2278, 352},	/* CFG_GPMC_AD11_IN */
    	{0x0288, 2297, 160},	/* CFG_GPMC_AD12_IN */
    	{0x0294, 2278, 108},	/* CFG_GPMC_AD13_IN */
    	{0x02A0, 2035, 0},	/* CFG_GPMC_AD14_IN */
    	{0x02AC, 2279, 378},	/* CFG_GPMC_AD15_IN */
    	{0x02B8, 2440, 70},	/* CFG_GPMC_AD1_IN */
    	{0x02C4, 2404, 446},	/* CFG_GPMC_AD2_IN */
    	{0x02D0, 2343, 212},	/* CFG_GPMC_AD3_IN */
    	{0x02DC, 2355, 322},	/* CFG_GPMC_AD4_IN */
    	{0x02E8, 2337, 192},	/* CFG_GPMC_AD5_IN */
    	{0x02F4, 2270, 314},	/* CFG_GPMC_AD6_IN */
    	{0x0300, 2339, 259},	/* CFG_GPMC_AD7_IN */
    	{0x030C, 2308, 577},	/* CFG_GPMC_AD8_IN */
    	{0x0318, 2334, 166},	/* CFG_GPMC_AD9_IN */
    //caravel
    	{0x0144, 0, 0},	/* CFG_GPMC_A13_IN */
    	{0x0150, 2575, 966},	/* CFG_GPMC_A14_IN */
    	{0x015C, 2503, 889},	/* CFG_GPMC_A15_IN */
    	{0x0168, 2528, 1007},	/* CFG_GPMC_A16_IN */
    	{0x0170, 0, 0},	/* CFG_GPMC_A16_OUT */
    	{0x0174, 2533, 980},	/* CFG_GPMC_A17_IN */
    	{0x0188, 590, 0},	/* CFG_GPMC_A18_OUT */
    	{0x0374, 0, 0},	/* CFG_GPMC_CS2_OUT */
    //caravel
    	{0x0378, 0, 0},	/* CFG_GPMC_CS3_IN */
    
    //caravel
    	{0x03D4, 2533, 980},	/* CFG_MCASP1_AXR10_OUT*/
    	{0x03E0, 0, 0},		/* CFG_MCASP1_AXR11_OUT*/
    	{0x0470, 590, 0},	/* CFG_MCASP1_AXR8_OUT*/
    	{0x0474, 2528, 1007},	/* CFG_MCASP1_AXR9_IN*/
    
    	{0x0678, 0, 386},	/* CFG_MMC3_CLK_IN */
    	{0x0680, 605, 0},	/* CFG_MMC3_CLK_OUT */
    	{0x0684, 0, 0},	/* CFG_MMC3_CMD_IN */
    	{0x0688, 0, 0},	/* CFG_MMC3_CMD_OEN */
    	{0x068C, 0, 0},	/* CFG_MMC3_CMD_OUT */
    	{0x0690, 171, 0},	/* CFG_MMC3_DAT0_IN */
    	{0x0694, 0, 0},	/* CFG_MMC3_DAT0_OEN */
    	{0x0698, 0, 0},	/* CFG_MMC3_DAT0_OUT */
    	{0x069C, 221, 0},	/* CFG_MMC3_DAT1_IN */
    	{0x06A0, 0, 0},	/* CFG_MMC3_DAT1_OEN */
    	{0x06A4, 0, 0},	/* CFG_MMC3_DAT1_OUT */
    	{0x06A8, 0, 0},	/* CFG_MMC3_DAT2_IN */
    	{0x06AC, 0, 0},	/* CFG_MMC3_DAT2_OEN */
    	{0x06B0, 0, 0},	/* CFG_MMC3_DAT2_OUT */
    	{0x06B4, 474, 0},	/* CFG_MMC3_DAT3_IN */
    	{0x06B8, 0, 0},	/* CFG_MMC3_DAT3_OEN */
    	{0x06BC, 0, 0},	/* CFG_MMC3_DAT3_OUT */
    	{0x06C0, 792, 0},	/* CFG_MMC3_DAT4_IN */
    	{0x06C4, 0, 0},	/* CFG_MMC3_DAT4_OEN */
    	{0x06C8, 0, 0},	/* CFG_MMC3_DAT4_OUT */
    	{0x06CC, 782, 0},	/* CFG_MMC3_DAT5_IN */
    	{0x06D0, 0, 0},	/* CFG_MMC3_DAT5_OEN */
    	{0x06D4, 0, 0},	/* CFG_MMC3_DAT5_OUT */
    	{0x06D8, 942, 0},	/* CFG_MMC3_DAT6_IN */
    	{0x06DC, 0, 0},	/* CFG_MMC3_DAT6_OEN */
    	{0x06E0, 0, 0},	/* CFG_MMC3_DAT6_OUT */
    	{0x06E4, 636, 0},	/* CFG_MMC3_DAT7_IN */
    	{0x06E8, 0, 0},	/* CFG_MMC3_DAT7_OEN */
    	{0x06EC, 0, 0},	/* CFG_MMC3_DAT7_OUT */
    	{0x06F0, 260, 0},	/* CFG_RGMII0_RXC_IN */
    	{0x06FC, 0, 1412},	/* CFG_RGMII0_RXCTL_IN */
    	{0x0708, 123, 1047},	/* CFG_RGMII0_RXD0_IN */
    	{0x0714, 139, 1081},	/* CFG_RGMII0_RXD1_IN */
    	{0x0720, 195, 1100},	/* CFG_RGMII0_RXD2_IN */
    	{0x072C, 239, 1216},	/* CFG_RGMII0_RXD3_IN */
    	{0x0740, 89, 0},	/* CFG_RGMII0_TXC_OUT */
    	{0x074C, 15, 125},	/* CFG_RGMII0_TXCTL_OUT */
    	{0x0758, 339, 162},	/* CFG_RGMII0_TXD0_OUT */
    	{0x0764, 146, 94},	/* CFG_RGMII0_TXD1_OUT */
    	{0x0770, 0, 27},	/* CFG_RGMII0_TXD2_OUT */
    	{0x077C, 291, 205},	/* CFG_RGMII0_TXD3_OUT */
    	{0x0A70, 0, 0},	/* CFG_VIN2A_D12_OUT */
    	{0x0A7C, 219, 101},	/* CFG_VIN2A_D13_OUT */
    	{0x0A88, 92, 58},	/* CFG_VIN2A_D14_OUT */
    	{0x0A94, 135, 100},	/* CFG_VIN2A_D15_OUT */
    	{0x0AA0, 154, 101},	/* CFG_VIN2A_D16_OUT */
    	{0x0AAC, 78, 27},	/* CFG_VIN2A_D17_OUT */
    	{0x0AB0, 411, 0},	/* CFG_VIN2A_D18_IN */
    	{0x0ABC, 0, 382},	/* CFG_VIN2A_D19_IN */
    	{0x0AD4, 320, 750},	/* CFG_VIN2A_D20_IN */
    	{0x0AE0, 192, 836},	/* CFG_VIN2A_D21_IN */
    	{0x0AEC, 294, 669},	/* CFG_VIN2A_D22_IN */
    	{0x0AF8, 50, 700},	/* CFG_VIN2A_D23_IN */
    	{0x0CC0, 2688, 0},	/* CFG_VIN3A_DE_OUT */
    	{0x0CD8, 2420, 0},	/* CFG_VIN3A_HSYNC_OUT */
    	{0x0CE4, 2274, 0},	/* CFG_VIN3A_VSYNC_OUT */
    //	{0x0B94, 0, 0},		/* CFG_VIN3A_CLK_OUT */
    	{0x0C00, 3033, 0},	/* CFG_VIN3A_D17_OUT */
    	{0x0C0C, 2780, 0},	/* CFG_VIN3A_D18_OUT */
    	{0x0C18, 2442, 0},	/* CFG_VIN3A_D19_OUT */
    	{0x0C30, 2955, 120},	/* CFG_VIN3A_D20_OUT */
    	{0x0C3C, 2572, 0},	/* CFG_VIN3A_D21_OUT */
    	{0x0C48, 2761, 0},	/* CFG_VIN3A_D22_OUT */
    	{0x0C54, 2674, 0},	/* CFG_VIN3A_D23_OUT */
    	{0x0CA8, 2970, 69},	/* CFG_VIN3A_D8_OUT */
    	{0x0CB4, 2992, 80},	/* CFG_VIN3A_D9_OUT */
    	{0x0BAC, 2924, 5},	/* CFG_VIN3A_D10_OUT */
    	{0x0BB8, 2993, 56},	/* CFG_VIN3A_D11_OUT */
    	{0x0BC4, 2944, 0},	/* CFG_VIN3A_D12_OUT */
    	{0x0BD0, 2916, 0},	/* CFG_VIN3A_D13_OUT */
    	{0x0BDC, 2917, 0},	/* CFG_VIN3A_D14_OUT */
    	{0x0BE8, 3013, 0},	/* CFG_VIN3A_D15_OUT */
    };
    
    const struct iodelay_cfg_entry iodelay_cfg_array_am574x_idk[] = {
    	{0x0114, 2199, 621},	/* CFG_GPMC_A0_IN */
    	{0x0120, 0, 0},	/* CFG_GPMC_A10_IN */
    	{0x012C, 2133, 859},	/* CFG_GPMC_A11_IN */
    	{0x0138, 2258, 562},	/* CFG_GPMC_A12_IN */
    	{0x0144, 0, 0},	/* CFG_GPMC_A13_IN */
    	{0x0150, 2149, 1052},	/* CFG_GPMC_A14_IN */
    	{0x015C, 2121, 997},	/* CFG_GPMC_A15_IN */
    	{0x0168, 2159, 1134},	/* CFG_GPMC_A16_IN */
    	{0x0170, 0, 0},	/* CFG_GPMC_A16_OUT */
    	{0x0174, 2135, 1085},	/* CFG_GPMC_A17_IN */
    	{0x0188, 0, 0},	/* CFG_GPMC_A18_OUT */
    	{0x0198, 1989, 612},	/* CFG_GPMC_A1_IN */
    	{0x0204, 2218, 912},	/* CFG_GPMC_A2_IN */
    	{0x0210, 2168, 963},	/* CFG_GPMC_A3_IN */
    	{0x021C, 2196, 813},	/* CFG_GPMC_A4_IN */
    	{0x0228, 2082, 782},	/* CFG_GPMC_A5_IN */
    	{0x0234, 2098, 407},	/* CFG_GPMC_A6_IN */
    	{0x0240, 2343, 585},	/* CFG_GPMC_A7_IN */
    	{0x024C, 2030, 685},	/* CFG_GPMC_A8_IN */
    	{0x0258, 2116, 832},	/* CFG_GPMC_A9_IN */
    	{0x0374, 0, 0},	/* CFG_GPMC_CS2_OUT */
    	{0x0590, 1000, 3900},	/* CFG_MCASP5_ACLKX_OUT */
    	{0x05AC, 1000, 3800},	/* CFG_MCASP5_FSX_IN */
    	{0x06F0, 451, 0},	/* CFG_RGMII0_RXC_IN */
    	{0x06FC, 127, 1571},	/* CFG_RGMII0_RXCTL_IN */
    	{0x0708, 165, 1178},	/* CFG_RGMII0_RXD0_IN */
    	{0x0714, 136, 1302},	/* CFG_RGMII0_RXD1_IN */
    	{0x0720, 0, 1520},	/* CFG_RGMII0_RXD2_IN */
    	{0x072C, 28, 1690},	/* CFG_RGMII0_RXD3_IN */
    	{0x0740, 121, 0},	/* CFG_RGMII0_TXC_OUT */
    	{0x074C, 60, 0},	/* CFG_RGMII0_TXCTL_OUT */
    	{0x0758, 153, 0},	/* CFG_RGMII0_TXD0_OUT */
    	{0x0764, 35, 0},	/* CFG_RGMII0_TXD1_OUT */
    	{0x0770, 0, 0},	/* CFG_RGMII0_TXD2_OUT */
    	{0x077C, 172, 0},	/* CFG_RGMII0_TXD3_OUT */
    	{0x0A70, 147, 0},	/* CFG_VIN2A_D12_OUT */
    	{0x0A7C, 110, 0},	/* CFG_VIN2A_D13_OUT */
    	{0x0A88, 18, 0},	/* CFG_VIN2A_D14_OUT */
    	{0x0A94, 82, 0},	/* CFG_VIN2A_D15_OUT */
    	{0x0AA0, 33, 0},	/* CFG_VIN2A_D16_OUT */
    	{0x0AAC, 0, 0},	/* CFG_VIN2A_D17_OUT */
    	{0x0AB0, 417, 0},	/* CFG_VIN2A_D18_IN */
    	{0x0ABC, 156, 843},	/* CFG_VIN2A_D19_IN */
    	{0x0AD4, 223, 1413},	/* CFG_VIN2A_D20_IN */
    	{0x0AE0, 169, 1415},	/* CFG_VIN2A_D21_IN */
    	{0x0AEC, 43, 1150},	/* CFG_VIN2A_D22_IN */
    	{0x0AF8, 0, 1210},	/* CFG_VIN2A_D23_IN */
    	{0x0B30, 0, 200},	/* CFG_VIN2A_D5_OUT */
    	{0x0B9C, 1281, 497},	/* CFG_VOUT1_CLK_OUT */
    	{0x0BA8, 379, 0},	/* CFG_VOUT1_D0_OUT */
    	{0x0BB4, 441, 0},	/* CFG_VOUT1_D10_OUT */
    	{0x0BC0, 461, 0},	/* CFG_VOUT1_D11_OUT */
    	{0x0BCC, 1189, 0},	/* CFG_VOUT1_D12_OUT */
    	{0x0BD8, 312, 0},	/* CFG_VOUT1_D13_OUT */
    	{0x0BE4, 298, 0},	/* CFG_VOUT1_D14_OUT */
    	{0x0BF0, 284, 0},	/* CFG_VOUT1_D15_OUT */
    	{0x0BFC, 152, 0},	/* CFG_VOUT1_D16_OUT */
    	{0x0C08, 216, 0},	/* CFG_VOUT1_D17_OUT */
    	{0x0C14, 408, 0},	/* CFG_VOUT1_D18_OUT */
    	{0x0C20, 519, 0},	/* CFG_VOUT1_D19_OUT */
    	{0x0C2C, 475, 0},	/* CFG_VOUT1_D1_OUT */
    	{0x0C38, 316, 0},	/* CFG_VOUT1_D20_OUT */
    	{0x0C44, 59, 0},	/* CFG_VOUT1_D21_OUT */
    	{0x0C50, 221, 0},	/* CFG_VOUT1_D22_OUT */
    	{0x0C5C, 96, 0},	/* CFG_VOUT1_D23_OUT */
    	{0x0C68, 264, 0},	/* CFG_VOUT1_D2_OUT */
    	{0x0C74, 421, 0},	/* CFG_VOUT1_D3_OUT */
    	{0x0C80, 1257, 0},	/* CFG_VOUT1_D4_OUT */
    	{0x0C8C, 432, 0},	/* CFG_VOUT1_D5_OUT */
    	{0x0C98, 436, 0},	/* CFG_VOUT1_D6_OUT */
    	{0x0CA4, 440, 0},	/* CFG_VOUT1_D7_OUT */
    	{0x0CB0, 81, 100},	/* CFG_VOUT1_D8_OUT */
    	{0x0CBC, 471, 0},	/* CFG_VOUT1_D9_OUT */
    	{0x0CC8, 0, 0},	/* CFG_VOUT1_DE_OUT */
    	{0x0CE0, 0, 0},	/* CFG_VOUT1_HSYNC_OUT */
    	{0x0CEC, 815, 0},	/* CFG_VOUT1_VSYNC_OUT */
    };
    
    const struct iodelay_cfg_entry iodelay_cfg_array_am572x_idk[] = {
    	{0x0114, 1861, 901},	/* CFG_GPMC_A0_IN */
    	{0x0120, 0, 0},	/* CFG_GPMC_A10_IN */
    	{0x012C, 1783, 1178},	/* CFG_GPMC_A11_IN */
    	{0x0138, 1903, 853},	/* CFG_GPMC_A12_IN */
    	{0x0144, 0, 0},	/* CFG_GPMC_A13_IN */
    	{0x0150, 2575, 966},	/* CFG_GPMC_A14_IN */
    	{0x015C, 2503, 889},	/* CFG_GPMC_A15_IN */
    	{0x0168, 2528, 1007},	/* CFG_GPMC_A16_IN */
    	{0x0170, 0, 0},	/* CFG_GPMC_A16_OUT */
    	{0x0174, 2533, 980},	/* CFG_GPMC_A17_IN */
    	{0x0188, 590, 0},	/* CFG_GPMC_A18_OUT */
    	{0x0198, 1652, 891},	/* CFG_GPMC_A1_IN */
    	{0x0204, 1888, 1212},	/* CFG_GPMC_A2_IN */
    	{0x0210, 1839, 1274},	/* CFG_GPMC_A3_IN */
    	{0x021C, 1868, 1113},	/* CFG_GPMC_A4_IN */
    	{0x0228, 1757, 1079},	/* CFG_GPMC_A5_IN */
    	{0x0234, 1800, 670},	/* CFG_GPMC_A6_IN */
    	{0x0240, 1967, 898},	/* CFG_GPMC_A7_IN */
    	{0x024C, 1731, 959},	/* CFG_GPMC_A8_IN */
    	{0x0258, 1766, 1150},	/* CFG_GPMC_A9_IN */
    	{0x0374, 0, 0},	/* CFG_GPMC_CS2_OUT */
    	{0x0590, 1000, 4200},	/* CFG_MCASP5_ACLKX_OUT */
    	{0x05AC, 800, 3800},	/* CFG_MCASP5_FSX_IN */
    	{0x06F0, 260, 0},	/* CFG_RGMII0_RXC_IN */
    	{0x06FC, 0, 1412},	/* CFG_RGMII0_RXCTL_IN */
    	{0x0708, 123, 1047},	/* CFG_RGMII0_RXD0_IN */
    	{0x0714, 139, 1081},	/* CFG_RGMII0_RXD1_IN */
    	{0x0720, 195, 1100},	/* CFG_RGMII0_RXD2_IN */
    	{0x072C, 239, 1216},	/* CFG_RGMII0_RXD3_IN */
    	{0x0740, 89, 0},	/* CFG_RGMII0_TXC_OUT */
    	{0x074C, 15, 125},	/* CFG_RGMII0_TXCTL_OUT */
    	{0x0758, 339, 162},	/* CFG_RGMII0_TXD0_OUT */
    	{0x0764, 146, 94},	/* CFG_RGMII0_TXD1_OUT */
    	{0x0770, 0, 27},	/* CFG_RGMII0_TXD2_OUT */
    	{0x077C, 291, 205},	/* CFG_RGMII0_TXD3_OUT */
    	{0x0A70, 0, 0},	/* CFG_VIN2A_D12_OUT */
    	{0x0A7C, 219, 101},	/* CFG_VIN2A_D13_OUT */
    	{0x0A88, 92, 58},	/* CFG_VIN2A_D14_OUT */
    	{0x0A94, 135, 100},	/* CFG_VIN2A_D15_OUT */
    	{0x0AA0, 154, 101},	/* CFG_VIN2A_D16_OUT */
    	{0x0AAC, 78, 27},	/* CFG_VIN2A_D17_OUT */
    	{0x0AB0, 411, 0},	/* CFG_VIN2A_D18_IN */
    	{0x0ABC, 0, 382},	/* CFG_VIN2A_D19_IN */
    	{0x0AD4, 320, 750},	/* CFG_VIN2A_D20_IN */
    	{0x0AE0, 192, 836},	/* CFG_VIN2A_D21_IN */
    	{0x0AEC, 294, 669},	/* CFG_VIN2A_D22_IN */
    	{0x0AF8, 50, 700},	/* CFG_VIN2A_D23_IN */
    	{0x0B30, 0, 0},	/* CFG_VIN2A_D5_OUT */
    	{0x0B9C, 1126, 751},	/* CFG_VOUT1_CLK_OUT */
    	{0x0BA8, 395, 0},	/* CFG_VOUT1_D0_OUT */
    	{0x0BB4, 282, 0},	/* CFG_VOUT1_D10_OUT */
    	{0x0BC0, 348, 0},	/* CFG_VOUT1_D11_OUT */
    	{0x0BCC, 1240, 0},	/* CFG_VOUT1_D12_OUT */
    	{0x0BD8, 182, 0},	/* CFG_VOUT1_D13_OUT */
    	{0x0BE4, 311, 0},	/* CFG_VOUT1_D14_OUT */
    	{0x0BF0, 285, 0},	/* CFG_VOUT1_D15_OUT */
    	{0x0BFC, 166, 0},	/* CFG_VOUT1_D16_OUT */
    	{0x0C08, 278, 0},	/* CFG_VOUT1_D17_OUT */
    	{0x0C14, 425, 0},	/* CFG_VOUT1_D18_OUT */
    	{0x0C20, 516, 0},	/* CFG_VOUT1_D19_OUT */
    	{0x0C2C, 521, 0},	/* CFG_VOUT1_D1_OUT */
    	{0x0C38, 386, 0},	/* CFG_VOUT1_D20_OUT */
    	{0x0C44, 111, 0},	/* CFG_VOUT1_D21_OUT */
    	{0x0C50, 227, 0},	/* CFG_VOUT1_D22_OUT */
    	{0x0C5C, 0, 0},	/* CFG_VOUT1_D23_OUT */
    	{0x0C68, 282, 0},	/* CFG_VOUT1_D2_OUT */
    	{0x0C74, 438, 0},	/* CFG_VOUT1_D3_OUT */
    	{0x0C80, 1298, 0},	/* CFG_VOUT1_D4_OUT */
    	{0x0C8C, 397, 0},	/* CFG_VOUT1_D5_OUT */
    	{0x0C98, 321, 0},	/* CFG_VOUT1_D6_OUT */
    	{0x0CA4, 155, 309},	/* CFG_VOUT1_D7_OUT */
    	{0x0CB0, 212, 0},	/* CFG_VOUT1_D8_OUT */
    	{0x0CBC, 466, 0},	/* CFG_VOUT1_D9_OUT */
    	{0x0CC8, 0, 0},	/* CFG_VOUT1_DE_OUT */
    	{0x0CE0, 0, 0},	/* CFG_VOUT1_HSYNC_OUT */
    	{0x0CEC, 139, 701},	/* CFG_VOUT1_VSYNC_OUT */
    };
    
    const struct iodelay_cfg_entry iodelay_cfg_array_am571x_idk[] = {
    	{0x0114, 1873, 702},	/* CFG_GPMC_A0_IN */
    	{0x0120, 0, 0},	/* CFG_GPMC_A10_IN */
    	{0x012C, 1851, 1011},	/* CFG_GPMC_A11_IN */
    	{0x0138, 2009, 601},	/* CFG_GPMC_A12_IN */
    	{0x0144, 0, 0},	/* CFG_GPMC_A13_IN */
    	{0x0150, 2247, 1186},	/* CFG_GPMC_A14_IN */
    	{0x015C, 2176, 1197},	/* CFG_GPMC_A15_IN */
    	{0x0168, 2229, 1268},	/* CFG_GPMC_A16_IN */
    	{0x0170, 0, 0},	/* CFG_GPMC_A16_OUT */
    	{0x0174, 2251, 1217},	/* CFG_GPMC_A17_IN */
    	{0x0188, 0, 0},	/* CFG_GPMC_A18_OUT */
    	{0x0198, 1629, 772},	/* CFG_GPMC_A1_IN */
    	{0x0204, 1734, 898},	/* CFG_GPMC_A2_IN */
    	{0x0210, 1757, 1076},	/* CFG_GPMC_A3_IN */
    	{0x021C, 1794, 893},	/* CFG_GPMC_A4_IN */
    	{0x0228, 1726, 853},	/* CFG_GPMC_A5_IN */
    	{0x0234, 1792, 612},	/* CFG_GPMC_A6_IN */
    	{0x0240, 2117, 610},	/* CFG_GPMC_A7_IN */
    	{0x024C, 1758, 653},	/* CFG_GPMC_A8_IN */
    	{0x0258, 1705, 899},	/* CFG_GPMC_A9_IN */
    	{0x0374, 0, 0},	/* CFG_GPMC_CS2_OUT */
    	{0x06F0, 413, 0},	/* CFG_RGMII0_RXC_IN */
    	{0x06FC, 27, 2296},	/* CFG_RGMII0_RXCTL_IN */
    	{0x0708, 3, 1721},	/* CFG_RGMII0_RXD0_IN */
    	{0x0714, 134, 1786},	/* CFG_RGMII0_RXD1_IN */
    	{0x0720, 40, 1966},	/* CFG_RGMII0_RXD2_IN */
    	{0x072C, 0, 2057},	/* CFG_RGMII0_RXD3_IN */
    	{0x0740, 0, 60},	/* CFG_RGMII0_TXC_OUT */
    	{0x074C, 0, 60},	/* CFG_RGMII0_TXCTL_OUT */
    	{0x0758, 0, 60},	/* CFG_RGMII0_TXD0_OUT */
    	{0x0764, 0, 0},	/* CFG_RGMII0_TXD1_OUT */
    	{0x0770, 0, 60},	/* CFG_RGMII0_TXD2_OUT */
    	{0x077C, 0, 120},	/* CFG_RGMII0_TXD3_OUT */
    	{0x0A70, 0, 0},	/* CFG_VIN2A_D12_OUT */
    	{0x0A7C, 170, 0},	/* CFG_VIN2A_D13_OUT */
    	{0x0A88, 150, 0},	/* CFG_VIN2A_D14_OUT */
    	{0x0A94, 0, 0},	/* CFG_VIN2A_D15_OUT */
    	{0x0AA0, 60, 0},	/* CFG_VIN2A_D16_OUT */
    	{0x0AAC, 60, 0},	/* CFG_VIN2A_D17_OUT */
    	{0x0AB0, 530, 0},	/* CFG_VIN2A_D18_IN */
    	{0x0ABC, 71, 1099},	/* CFG_VIN2A_D19_IN */
    	{0x0AD4, 142, 1337},	/* CFG_VIN2A_D20_IN */
    	{0x0AE0, 114, 1517},	/* CFG_VIN2A_D21_IN */
    	{0x0AEC, 171, 1331},	/* CFG_VIN2A_D22_IN */
    	{0x0AF8, 0, 1328},	/* CFG_VIN2A_D23_IN */
    };
    
    const struct iodelay_cfg_entry iodelay_cfg_array_am571x_idk_4port[] = {
    	{0x0588, 2100, 1959},	/* CFG_MCASP5_ACLKX_IN */
    	{0x05AC, 2100, 1780},	/* CFG_MCASP5_FSX_IN */
    	{0x0B30, 0, 400},	/* CFG_VIN2A_D5_OUT */
    };
    #endif
    #endif /* _MUX_DATA_BEAGLE_X15_H_ */
    

    Thanking you,

    Regards,

    Ramachandra

  • Hi Ramachandra,

    Video nodes are usually created by video_register_device(). This is called by alloc_stream() in the driver, which is called by vip_create_streams() in vip driver. Can you please check if video_register_device is getting called in your case and if it is running successfully?

    Regards,
    Parth

  • Hi sir,

    In gs2971.c not calling these functions video_register_device(), alloc_stream(),vip_create_streams().

    Actually i will add alloc_stream then kernel_panic is hapeening.

    Thanking you,

    Ramachandra

  • Hi Ramachandra,


    Can you please comment out v4l2_int_device_register in your gs2971 driver probe (Line-1553) and just use the v4l2_spi_subdev_init, v4l2_subdev_init and ret = v4l2_async_register_subdev and check.

    Regards,
    Parth

  • hi  sir,

    After running spi_subdev_init,async it is hanging


    Arago Project http://arago-project.org am57xx-evm ttyS2

    Arago 2019.07 am57xx-evm ttyS2

    am57xx-evm login: root
    root@am57xx-evm:~# cd ..
    root@am57xx-evm:/home# cd ..
    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/platform/mxc/capture/v4l2-int-device.ko
    root@am57xx-evm:/# insmod /lib/modules/4.19.59-g5f8c1c6121/kernel/drivers/media/platform/mxc/capture/gs2971_video.ko
    [ 46.555253] gs2971 spi3.2: mclk=19bfcc0
    [ 46.559363] gs2971 spi3.2: ipu=1
    [ 46.562616] gs2971_probe:cea861=0
    [ 46.565949] gs2971 spi3.2: pixelformat=1448695129
    [ 46.572409] gs2971 spi3.2: width=1920
    [ 46.576626] gs2971 spi3.2: height=1080
    [ 46.580389] gs2971 spi3.2: capability=1001
    [ 46.584503] gs2971_gpio_state: active=0, standby-gpios(0)=0x0
    [ 47.676355] gs2971 spi3.2: status=0, read value of 0x000000c0, expected 0x000000c0
    [ 47.684652] gs2971 spi3.2: register 00 = 000000c0
    [ 47.689513] gs2971 spi3.2: register 01 = 00000000
    [ 47.694320] gs2971 spi3.2: register 02 = 00000000
    [ 47.699154] gs2971 spi3.2: register 03 = 00000000
    [ 47.703960] gs2971 spi3.2: register 04 = 00000000
    [ 47.708786] gs2971 spi3.2: register 05 = 00004210
    [ 47.713585] gs2971 spi3.2: register 06 = 00000b66
    [ 47.718394] gs2971 spi3.2: register 07 = 00001dff
    [ 47.723192] gs2971 spi3.2: register 08 = 00000820
    [ 47.728037] gs2971 spi3.2: register 09 = 00001883
    [ 47.732836] gs2971 spi3.2: register 0a = 00000000
    [ 47.737695] gs2971 spi3.2: register 0b = 00000000
    [ 47.742491] gs2971 spi3.2: register 0c = 00000000
    [ 47.747305] gs2971 spi3.2: register 0d = 00000000
    [ 47.752100] gs2971 spi3.2: register 0e = 00000000
    [ 47.756930] gs2971 spi3.2: register 0f = 00000000
    [ 47.761784] gs2971 spi3.2: register 10 = 00000000
    [ 47.766618] gs2971 spi3.2: register 11 = 00000000
    [ 47.771413] gs2971 spi3.2: register 12 = 00000000
    [ 47.776245] gs2971 spi3.2: register 13 = 00000000
    [ 47.781042] gs2971 spi3.2: register 14 = 00000000
    [ 47.785838] gs2971 spi3.2: register 15 = 00000000
    [ 47.790693] gs2971 spi3.2: register 16 = 00000000
    [ 47.795488] gs2971 spi3.2: register 17 = 00000000
    [ 47.800307] gs2971 spi3.2: register 18 = 00000000
    [ 47.805102] gs2971 spi3.2: register 19 = 00000000
    [ 47.809933] gs2971 spi3.2: register 1a = 00000000
    [ 47.814729] gs2971 spi3.2: register 1b = 00000000
    [ 47.819559] gs2971 spi3.2: register 1c = 00000000
    [ 47.824354] gs2971 spi3.2: register 1d = 00000000
    [ 47.829184] gs2971 spi3.2: register 1e = 00000000
    [ 47.833978] gs2971 spi3.2: register 1f = 00000780
    [ 47.838828] gs2971 spi3.2: register 20 = 00000898
    [ 47.843626] gs2971 spi3.2: register 21 = 00000465
    [ 47.848455] gs2971 spi3.2: register 22 = 00001438
    [ 47.853249] gs2971 spi3.2: register 23 = 00000003
    [ 47.858080] gs2971 spi3.2: register 24 = 00000004
    [ 47.863120] gs2971 spi3.2: register 25 = 00000022
    [ 47.867881] gs2971_gpio_state: active=1, standby-gpios(0)=0x1
    [ 47.873655] (NULL device *): v4l2_async_register_subdev Entered
    [ 47.879630] (NULL device *): v4l2_async_notifier_find_v4l2_dev1
    [ 47.885573] (NULL device *): v4l2_async_notifier_find_v4l2_dev2
    [ 47.891572] (NULL device *): v4l2_async_notifier_find_v4l2_dev After loop
    [ 47.898414] (NULL device *): v4l2_async_find_match
    [ 47.903223] (NULL device *): v4l2_async_find_match match_fwnode
    [ 47.909195] (NULL device *): v4l2_async_find_match match_fwnode1
    [ 47.915223] (NULL device *): v4l2_async_match_notify
    [ 47.920221] (NULL device *): v4l2_async_match_notify v4l2_async_notifier_call_bound start
    [ 47.928457] (NULL device *): v4l2_async_notifier_call_bound start
    [ 47.934572] (NULL device *): v4l2_async_notifier_call_bound end
    [ 47.940574] vin3a: Port A: Using subdev gs2971 for capture

    It is hangs not coming out of loop

    Thank you sir

  • Hi Ramachandra,

    Can you please explain which loop are you referring here? Please share the API where the code is hanging.

    Regards,
    Parth

  • Hi sir,

    I am using below gs2971 code(linux/driver/media/platform/mxc/capture/gs2971.c

    /* SEMTECH SD SDI reciever
     *
     * Copyright (C) 2014 RidgeRun
     * Author: Edison Fernández <edison.fernández@ridgerun.com>
     *
     * Currently working with 1080p30 and 720p60 with no audio support.
     * In order to support more standars the VD_STD value should be
     * used in order to identify the incomming resolution and framerate.
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License as published by
     * the Free Software Foundation; either version 2 of the License, or
     * (at your option) any later version.
     *
     * This program is distributed in the hope that it will be useful,
     * but WITHOUT ANY WARRANTY; without even the implied warranty of
     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     * GNU General Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program; if not, write to the Free Software
     * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
     */
    
    /*!
     * @file gs2971.c
     *
     * @brief SEMTECH SD SDI reciever
     *
     * @ingroup Camera
     */
    
    #include <linux/module.h>
    #include <linux/init.h>
    #include <linux/types.h>
    #include <linux/delay.h>
    #include <linux/device.h>
    #include <linux/i2c.h>
    #include <linux/of_gpio.h>
    #include <linux/videodev2.h>
    #include <linux/regulator/consumer.h>
    #include <linux/fsl_devices.h>
    #include <media/v4l2-chip-ident.h>
    //#include <media/v4l2-int-device.h>
    #include "v4l2-int-device.h"
    #include "mxc_v4l2_capture.h"
    #include <linux/proc_fs.h>
    
    #include <media/v4l2-async.h>
    #include <media/v4l2-device.h>
    #include <media/v4l2-common.h>
    #include <media/v4l2-mediabus.h>
    //#include <media/v4l2-of.h>
    #include <media/v4l2-ctrls.h>
    #include <media/media-entity.h>
    #include <linux/videodev2.h>
    
    #include <media/v4l2-ctrls.h>
    #include <media/v4l2-device.h>
    #include <media/v4l2-event.h>
    #include <media/v4l2-image-sizes.h>
    #include <media/v4l2-subdev.h>
    #include <media/v4l2-mediabus.h>
    #include <media/v4l2-common.h>
    //#include <media/v4l2-of.h>
    #include <media/v4l2-dv-timings.h>
    #include <media/v4l2-ioctl.h>
    
    #include "gs2971.h"
    
    #define DEBUG 1
    #define DRIVER_NAME     "gs2971"
    
    /* Debug functions */
    static int debug = 1;
    module_param(debug, int, 0644);
    MODULE_PARM_DESC(debug, "Debug level (0-2)");
    
    static struct gs2971_spidata *spidata;
    
    #define YUV_FORMAT(gs) ((gs->cea861) ? V4L2_PIX_FMT_UYVY : V4L2_PIX_FMT_YUYV)
    
    /*! @brief This mutex is used to provide mutual exclusion.
     *
     *  Create a mutex that can be used to provide mutually exclusive
     *  read/write access to the globally accessible data structures
     *  and variables that were defined above.
     */
    static DEFINE_MUTEX(mutex);
    
    int gs2971_read_buffer(struct spi_device *spi, u16 offset, u16 * values,
    		       int length)
    {
    	struct spi_message msg;
    	struct spi_transfer spi_xfer;
    	int status;
    	struct gs2971_spidata *sp = spidata;
    
    	if (!spi)
    		return -ENODEV;
    
    	if (length > GS2971_SPI_TRANSFER_MAX)
    		return -EINVAL;
    
    	sp->txbuf[0] = 0x8000 | (offset & 0xfff);	/* read */
    	if (length > 1)
    		sp->txbuf[0] |= 0x1000;	/* autoinc */
    
    	memset(&spi_xfer, '\0', sizeof(spi_xfer));
    	spi_xfer.tx_buf = sp->txbuf;
    	spi_xfer.rx_buf = sp->rxbuf;
    	spi_xfer.bits_per_word = 16;
    	spi_xfer.delay_usecs = 0;
    	spi_xfer.speed_hz = 1000000;
    	spi_xfer.len = sizeof(*values) * (length + 1);	// length in bytes
    
    	spi_message_init(&msg);
    	spi_message_add_tail(&spi_xfer, &msg);
    
    	status = spi_sync(spi, &msg);
    	
    	memcpy(values, &sp->rxbuf[1], sizeof(*values) * length);
    	if (status)
    		pr_err(">> Read buffer(%d) (%x): %x %x, %x %x\n", status,
    		       offset, sp->txbuf[0], sp->txbuf[1], sp->rxbuf[0],
    		       sp->rxbuf[1]);
    
    	return status;
    }
    
    int gs2971_read_register(struct spi_device *spi, u16 offset, u16 * value)
    {
    	struct spi_message msg;
    	struct spi_transfer spi_xfer;
    	int status;
    	u32 txbuf[1];
    	u32 rxbuf[1];
    
    	if (!spi)
    		return -ENODEV;
    
    	txbuf[0] = 0x80000000 | ((offset & 0xfff) << 16);	/* read */
    
    
    	memset(&spi_xfer, '\0', sizeof(spi_xfer));
    	spi_xfer.tx_buf = txbuf;
    	spi_xfer.rx_buf = rxbuf;
    	spi_xfer.bits_per_word = 32;	
    	spi_xfer.delay_usecs = 0;	
    	spi_xfer.speed_hz = 1000000;
    	spi_xfer.len = 4;	// length in bytes
    
    	spi_message_init(&msg);
    	spi_message_add_tail(&spi_xfer, &msg);
    
    	status = spi_sync(spi, &msg);
    
    	//dev_err(&spi->dev, "read_register status=%x\n", status);	//cispl
    	if (status) {
    		dev_dbg(&spi->dev, "read_reg failed\n");
    		*value = 0xffff;
    	} else {
    		*value = (u16) rxbuf[0];
    	}
    
    	if (status)
    		pr_err(">> Read register(%d) (%x): %x, %x\n", status, offset,
    		       txbuf[0], rxbuf[0]);
    
    	pr_debug("--> Read register (%x) with value: %x", offset, *value);
    	return status;
    }
    
    int gs2971_write_buffer(struct spi_device *spi, u16 offset, u16 * values,
    			int length)
    {
    	struct spi_message msg;
    	struct spi_transfer spi_xfer;
    	int status;
    	struct gs2971_spidata *sp = spidata;
    
    	if (!spi)
    		return -ENODEV;
    
    	if (length > GS2971_SPI_TRANSFER_MAX - 1)
    		return -EINVAL;
    
    	sp->txbuf[0] = (offset & 0xfff);	/* write  */
    	if (length > 1)
    		sp->txbuf[0] |= 0x1000;	/* autoinc */
    	memcpy(&sp->txbuf[1], values, sizeof(*values) * length);
    
    	memset(&spi_xfer, '\0', sizeof(spi_xfer));
    	spi_xfer.tx_buf = sp->txbuf;
    	spi_xfer.rx_buf = sp->rxbuf;
    	spi_xfer.bits_per_word = 16;
    	spi_xfer.delay_usecs = 0;
    	spi_xfer.speed_hz = 1000000;
    	spi_xfer.len = sizeof(*values) * (length + 1);	// length in bytes
    
    	spi_message_init(&msg);
    	spi_message_add_tail(&spi_xfer, &msg);
    
    	status = spi_sync(spi, &msg);
    	if (status)
    		pr_err(">> Write register(%d) (%x): %x %x, %x %x\n", status,
    		       offset, sp->txbuf[0], sp->txbuf[1], sp->rxbuf[0],
    		       sp->rxbuf[1]);
    	return status;
    }
    
    int gs2971_write_register(struct spi_device *spi, u16 offset, u16 value)
    {
    	pr_debug("--> Writing to address (%x) : %x\n", offset, value);
    	return gs2971_write_buffer(spi, offset, &value, 1);
    }
    const char *gpio_names[] = {
    [GPIO_STANDBY] = "standby-gpios",
    [GPIO_RESET] = "rst-gpios",
    [GPIO_TIM_861] = "tim_861-gpios",
    [GPIO_IOPROC_EN] = "ioproc_en-gpios",
    [GPIO_SW_EN] = "sw_en-gpios",
    [GPIO_RC_BYPASS] = "rc_bypass-gpios",
    [GPIO_AUDIO_EN] = "audio_en-gpios",
    [GPIO_DVB_ASI] = "dvb_asi-gpios",
    [GPIO_SMPTE_BYPASS] = "smpte_bypass-gpios",
    [GPIO_DVI_LOCK] = "dvi_lock-gpios",
    [GPIO_DATA_ERR] = "data_err-gpios",
    [GPIO_LB_CONT] = "lb_cont-gpios",
    [GPIO_Y_1ANC] = "y_1anc-gpios",
    };
    
    void gs2971_gpio_state(struct gs2971_priv *gs, int index, int active)
    {
    	if (gpio_is_valid(gs->gpios[index])) {
    		int state = (gs->gpio_flags[index] & OF_GPIO_ACTIVE_LOW) ? 1 : 0;
    
    		state ^= active;
    		gpio_set_value(gs->gpios[index], state);
    		pr_info("%s: active=%d, %s(%d)=0x%x\n", __func__, active, gpio_names[index], gs->gpios[index], state);
    	}
    }
    
    static void gs2971_change_gpio_state(struct gs2971_priv *gs, int on)
    {
    	gs2971_gpio_state(gs, GPIO_STANDBY, on ? 0 : 1);
    	if (on) {
    		pr_debug("%s: power up delay\n", __func__);
    		msleep(1000);
    	}
    }
    
    static int gs2971_get_gpios(struct gs2971_priv *gs, struct device *dev)
    {
    	int i;
    	int ret;
    	enum of_gpio_flags flags;
    
    	for (i = 0; i < GPIO_CNT; i++) {
    		gs->gpios[i] = of_get_named_gpio_flags(dev->of_node, gpio_names[i], 0, &flags);
    		if (!gpio_is_valid(gs->gpios[i])) {
    			pr_info("%s: gpio %s not available\n", __func__, gpio_names[i]);
    		} else {
    			int gflags = (flags & OF_GPIO_ACTIVE_LOW) ? GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
    
    			if ((i == GPIO_STANDBY) || (i == GPIO_RESET))
    				gflags ^= GPIOF_INIT_HIGH;
    			if (flags == 2)
    				gflags = GPIOF_IN;
    
    			gs->gpio_flags[i] = flags;
    			pr_info("%s: %s flags(%d -> %d)\n", __func__, gpio_names[i], flags, gflags);
    			ret = devm_gpio_request_one(dev, gs->gpios[i], gflags, gpio_names[i]);
    			if (ret < 0) {
    				pr_info("%s: request of %s failed(%d)\n", __func__, gpio_names[i], ret);
    				return ret;
    			}
    		}
    	}
    	gs2971_gpio_state(gs, GPIO_IOPROC_EN, 1);	//active ioproc_en
    	msleep(2);
    	gs2971_gpio_state(gs, GPIO_RESET, 0);	//remove reset
    	msleep(400);
    	return 0;
    }
    
    static s32 power_control(struct gs2971_priv *gs, int on)
    {
    	struct sensor_data *sensor = &gs->sensor;
    	int i;
    	int ret = 0;
    
    	pr_debug("%s: %d\n", __func__, on);
    	if (sensor->on != on) {
    		if (on) {
    			for (i = 0; i < REGULATOR_CNT; i++) {
    				if (gs->regulator[i]) {
    					ret = regulator_enable(gs->regulator[i]);
    					if (ret) {
    						pr_err("%s:regulator_enable failed(%d)\n",
    							__func__, ret);
    						on = 0;	/* power all off */
    						break;
    					}
    				}
    			}
    		}
    		gs2971_change_gpio_state(gs, on);
    		sensor->on = on;
    		if (!on) {
    			for (i = REGULATOR_CNT - 1; i >= 0; i--) {
    				if (gs->regulator[i])
    					regulator_disable(gs->regulator[i]);
    			}
    		}
    	}
    	return ret;
    }
    
    static struct spi_device *gs2971_get_spi(struct gs2971_spidata *spidata)
    {
    	if (!spidata)
    		return NULL;
    	return spidata->spi;
    }
    
    static int get_std(struct v4l2_int_device *s, v4l2_std_id * id)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	struct spi_device *spi = NULL;
    	u16 std_lock_value;
    	u16 sync_lock_value;
    	u16 words_per_actline_value;
    	u16 words_per_line_value;
    	u16 lines_per_frame_value;
    	u16 actlines_per_frame_value;
    	u16 interlaced_flag;
    	int status;
    	u16 sd_audio_status_value;
    	u16 hd_audio_status_value;
    	u16 sd_audio_config_value;
    	u16 hd_audio_config_value;
    	u16 readback_value;
    	u16 ds1, ds2;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	gs->mode = gs2971_mode_not_supported;
    	gs->framerate = gs2971_default_fps;
    
    	spi = gs2971_get_spi(spidata);
    	if (!spi)
    		return -ENODEV;
    
    	*id = V4L2_STD_UNKNOWN;
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT4, &std_lock_value);
    	actlines_per_frame_value = std_lock_value & GS_RS4_ACTLINES_PER_FIELD;
    	interlaced_flag = std_lock_value & GS_RS4_INT_nPROG;
    
    	status =
    	    gs2971_read_register(spi, GS2971_FLYWHEEL_STATUS, &sync_lock_value);
    	if (status)
    		return status;
    	pr_debug("--> lock_value %x\n", sync_lock_value);
    	if (!sync_lock_value) {
    		pr_err("%s: no lock, gs2971\n", __func__);
    		return -EBUSY;
    	}
    
    	status = gs2971_read_register(spi, GS2971_DATA_FORMAT_DS1, &ds1);
    	if (status)
    		return status;
    	status = gs2971_read_register(spi, GS2971_DATA_FORMAT_DS2, &ds2);
    	if (status)
    		return status;
    	pr_debug("--> ds1=%x\n--> ds2=%x\n", ds1, ds2);
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT1,
    				 &words_per_actline_value);
    	if (status)
    		return status;
    	words_per_actline_value &= GS_RS1_WORDS_PER_ACTLINE;
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT2,
    				 &words_per_line_value);
    	if (status)
    		return status;
    	words_per_line_value &= GS_RS2_WORDS_PER_LINE;
    
    	status =
    	    gs2971_read_register(spi, GS2971_RASTER_STRUCT3,
    				 &lines_per_frame_value);
    	if (status)
    		return status;
    	lines_per_frame_value &= GS_RS3_LINES_PER_FRAME;
    
    	pr_debug("--> Words per line %u/%u Lines per frame %u/%u\n",
    		 (unsigned int)words_per_actline_value,
    		 (unsigned int)words_per_line_value,
    		 (unsigned int)actlines_per_frame_value,
    		 (unsigned int)lines_per_frame_value);
    	pr_debug("--> SyncLock: %s %s StdLock: 0x%04x\n",
    		 (sync_lock_value & GS_FLY_V_LOCK_DS1) ? "Vsync" : "NoVsync",
    		 (sync_lock_value & GS_FLY_H_LOCK_DS1) ? "Hsync" : "NoHsync",
    		 (unsigned int)(std_lock_value));
    
    	status =
    	    gs2971_read_register(spi, GS2971_CH_VALID, &sd_audio_status_value);
    	if (status)
    		return status;
    
    	status =
    	    gs2971_read_register(spi, GS2971_HD_CH_VALID,
    				 &hd_audio_status_value);
    	if (status)
    		return status;
    
    	if (!lines_per_frame_value) {
    		pr_err("%s: 0 frame size\n", __func__);
    		return -EBUSY;
    	}
    
    	if (gs->cea861) {
    		sensor->spix.swidth = words_per_line_value - 1;
    		sensor->spix.sheight = lines_per_frame_value;
    	}
    	if (interlaced_flag && lines_per_frame_value == 525) {
    		pr_debug("--> V4L2_STD_525_60\n");
    		*id = V4L2_STD_525_60;
    	} else if (interlaced_flag && lines_per_frame_value == 625) {
    		pr_debug("--> V4L2_STD_625_50\n");
    		*id = V4L2_STD_625_50;
    	} else if (interlaced_flag && lines_per_frame_value == 525) {
    		pr_debug("--> V4L2_STD_525P_60\n");
    		*id = YUV_FORMAT(gs);
    	} else if (interlaced_flag && lines_per_frame_value == 625) {
    		pr_debug("--> V4L2_STD_625P_50\n");
    		*id = YUV_FORMAT(gs);
    	} else if (!interlaced_flag && 749 <= lines_per_frame_value
    		   && lines_per_frame_value <= 750) {
    		if (gs->cea861) {
    			sensor->spix.left = 220;
    			sensor->spix.top = 25;
    		}
    		sensor->pix.width = 1280;
    		sensor->pix.height = 720;
    		if (words_per_line_value > 1650) {
    			pr_debug("--> V4L2_STD_720P_50\n");
    			*id = YUV_FORMAT(gs);
    		} else {
    			pr_debug("--> V4L2_STD_720P_60\n");
    			gs->mode = gs2971_mode_720p;
    			gs->framerate = gs2971_60_fps;
    			*id = YUV_FORMAT(gs);
    		}
    	} else if (!interlaced_flag && 1124 <= lines_per_frame_value
    		   && lines_per_frame_value <= 1125) {
    		sensor->pix.width = 1920;
    		sensor->pix.height = 1080;
    		gs->mode = gs2971_mode_1080p;
    		gs->framerate = gs2971_30_fps;	// Currently only 1080p30 is supported
    
    		if (words_per_line_value >= 2200 + 550) {
    			pr_debug("--> V4L2_STD_1080P_24\n");
    			*id = YUV_FORMAT(gs);
    		} else if (words_per_line_value >= 2200 + 440) {
    			pr_debug("--> V4L2_STD_1080P_25\n");
    			*id = YUV_FORMAT(gs);
    		} else {
    			pr_debug("--> V4L2_STD_1080P_60\n");
    			*id = YUV_FORMAT(gs);
    		}
    	} else if (interlaced_flag && 1124 <= lines_per_frame_value
    		   && lines_per_frame_value <= 1125) {
    
    		sensor->pix.width = 1920;
    		sensor->pix.height = 1080;
    		if (words_per_line_value >= 2200 + 440) {
    			pr_debug("--> V4L2_STD_1080I_50\n");
    			*id = YUV_FORMAT(gs);
    		} else {
    			pr_debug("--> V4L2_STD_1080I_60\n");
    			*id = YUV_FORMAT(gs);
    		}
    	} else {
    		dev_err(&spi->dev,
    			"Std detection failed: interlaced_flag: %u words per line %u/%u Lines per frame %u/%u SyncLock: %s %s StdLock: 0x%04x\n",
    			(unsigned int)interlaced_flag,
    			(unsigned int)words_per_actline_value,
    			(unsigned int)words_per_line_value,
    			(unsigned int)actlines_per_frame_value,
    			(unsigned int)lines_per_frame_value,
    			(sync_lock_value & GS_FLY_V_LOCK_DS1) ? "Vsync" :
    			"NoVsync",
    			(sync_lock_value & GS_FLY_H_LOCK_DS1) ? "Hsync" :
    			"NoHsync", (unsigned int)(std_lock_value));
    		return -1;
    	}
    
    	sd_audio_config_value = 0xaaaa;	// 16-bit, right-justified
    
    	status =
    	    gs2971_write_register(spi, GS2971_CFG_AUD, sd_audio_config_value);
    	if (!status) {
    		status =
    		    gs2971_read_register(spi, GS2971_CFG_AUD, &readback_value);
    		if (!status) {
    			if (sd_audio_config_value != readback_value) {
    				dev_dbg(&spi->dev,
    					"SD audio readback failed, wanted x%04x, got x%04x\n",
    					(unsigned int)sd_audio_config_value,
    					(unsigned int)readback_value);
    			}
    		}
    	}
    
    	hd_audio_config_value = 0x0aa4;	// 16-bit, right-justified
    	status =
    	    gs2971_write_register(spi, GS2971_HD_CFG_AUD,
    				  hd_audio_config_value);
    	if (!status) {
    		status =
    		    gs2971_read_register(spi, GS2971_HD_CFG_AUD,
    					 &readback_value);
    		if (!status) {
    			if (hd_audio_config_value != readback_value) {
    				dev_dbg(&spi->dev,
    					"HD audio readback failed, wanted x%04x, got x%04x\n",
    					(unsigned int)hd_audio_config_value,
    					(unsigned int)readback_value);
    			}
    		}
    	}
    
    	status =
    	    gs2971_write_register(spi, GS2971_ANC_CONTROL, ANCCTL_ANC_DATA_DEL);
    	if (status)
    		return status;
    	pr_debug("--> remove anc data\n");
    
    #if 0
    	status = gs2971_write_register(spi, GS2971_ACGEN_CTRL,
    				       (GS2971_ACGEN_CTRL_SCLK_INV_MASK |
    					GS2971_ACGEN_CTRL_MCLK_SEL_128FS));
    #endif
    	return 0;
    }
    
    static void gs2971_workqueue_handler(struct work_struct *data);
    
    DECLARE_WORK(gs2971_worker, gs2971_workqueue_handler);
    
    static void gs2971_workqueue_handler(struct work_struct *ignored)
    {
    	struct spi_device *spi;
    	u16 bank_reg_base, anc_reg;
    	static u16 anc_buf[257];
    	int anc_length;
    	int adf_found = 1;
    	int ch_id;
    	int status;
    	u16 did, sdid;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	for (ch_id = 0; ch_id < GS2971_NUM_CHANNELS; ch_id++) {
    
    		spi = gs2971_get_spi(spidata);
    		if (!spi)
    			continue;
    
    		/* Step 2: start writing to other bank */
    		gs2971_write_register(spi, GS2971_ANC_CONTROL,
    				      ANCCTL_ANC_DATA_DEL |
    				      ANCCTL_ANC_DATA_SWITCH);
    
    #if 1
    		/* Step 1: read ancillary data */
    		bank_reg_base = GS2971_ANC_BANK_REG;
    		status = 0;
    		for (anc_reg = bank_reg_base, adf_found = 1; (0 == status) &&
    		     ((anc_reg + 6) < bank_reg_base + GS2971_ANC_BANK_SIZE);) {
    			status = gs2971_read_buffer(spi, anc_reg, anc_buf, 6);
    			anc_reg += 6;
    
    			if (anc_reg >= bank_reg_base + GS2971_ANC_BANK_SIZE)
    				break;
    
    			if (!status) {
    				if (anc_buf[0] == 0 ||
    				    anc_buf[1] == 0xff || anc_buf[2] == 0xff) {
    					did = anc_buf[3];
    					sdid = anc_buf[4];
    					anc_length = (anc_buf[5] & 0xff) + 1;
    					anc_reg += anc_length;
    
    					if (!(did == 0 && sdid == 0)
    					    && (did < 0xf8)) {
    						dev_dbg(&spi->dev,
    							"anc[%x] %02x %02x %02x\n",
    							anc_reg, did, sdid,
    							anc_length);
    					}
    				} else {
    					break;
    				}
    			}
    		}
    		dev_dbg(&spi->dev, "anc_end[%x] %02x %02x %02x\n",
    			anc_reg, anc_buf[0], anc_buf[1], anc_buf[2]);
    #endif
    
    		/* Step 3: switch reads to other bank */
    		gs2971_write_register(spi, GS2971_ANC_CONTROL,
    				      ANCCTL_ANC_DATA_DEL);
    	}
    }
    
    #if defined(GS2971_ENABLE_ANCILLARY_DATA)
    static int gs2971_init_ancillary(struct spi_device *spi)
    {
    	pr_debug("-> In function %s\n", __func__);
    
    	u16 value;
    	int offset;
    
    	int status = 0;
    
    	/* Set up ancillary data filtering */
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE1, 0x4100);
    	/*  SMPTE-352M Payload ID (0x4101) */
    	if (!status)
    		status = gs2971_write_register(spi, GS2971_REG_ANC_TYPE2, 0x5f00);	/* Placeholder */
    
    	if (!status)
    		status = gs2971_write_register(spi, GS2971_REG_ANC_TYPE3, 0x6000);	/* Placeholder */
    
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE4, 0x6100);
    	/* SMPTE 334 - SDID 01=EIA-708, 02=EIA-608 */
    
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_REG_ANC_TYPE5, 0x6200);
    	/* SMPTE 334 - SDID 01=Program description, 02=Data broadcast, 03=VBI data */
    
    	if (0 == gs2971_read_register(spi, GS2971_REG_ANC_TYPE1, &value)) {
    		dev_dbg(&spi->dev, "REG_ANC_TYPE1 value x%04x\n",
    			(unsigned int)value);
    	}
    	if (0 == gs2971_read_register(spi, GS2971_REG_ANC_TYPE2, &value)) {
    		dev_dbg(&spi->dev, "REG_ANC_TYPE2 value x%04x\n",
    			(unsigned int)value);
    	}
    
    	/* Clear old ancillary data */
    	if (!status)
    		status = gs2971_write_register(spi, GS2971_ANC_CONTROL,
    					       ANCCTL_ANC_DATA_DEL |
    					       ANCCTL_ANC_DATA_SWITCH);
    
    	/* Step 2: start writing to other bank */
    	if (!status)
    		status =
    		    gs2971_write_register(spi, GS2971_ANC_CONTROL,
    					  ANCCTL_ANC_DATA_DEL);
    	return status;
    }
    #endif
    
    /* gs2971_initialize :
     * This function will set the video format standard
     */
    static int gs2971_initialize(struct gs2971_priv *gs, struct spi_device *spi)
    {
    	int status = 0;
    	int retry = 0;
    	u16 value,i;
    	static u16 anc_buf[257];
    
    	static void __iomem *base;
    
    	//base = ioremap(0x4A009800, SZ_4K);	cispl
    	//__raw_writel(0x02,base);    		cispl
    
    //	u16 cfg = GS_VCFG1_861_PIN_DISABLE_MASK;
    	u16 cfg = 0xC0;
    	if (gs->cea861)		
    		cfg |= GS_VCFG1_TIMING_861_MASK;
    
    	pr_debug("-> In function %s\n", __func__);
    	for (;;) {
    		status = gs2971_write_register(spi, GS2971_VCFG1, cfg);
    
    		if (status)
    			return status;
    		status = gs2971_read_register(spi, GS2971_VCFG1, &value);
    
    		if (status)
    			return status;
    		dev_err(&spi->dev, "status=%x, read value of 0x%08x, expected 0x%08x\n", status,
    			(unsigned int)value, cfg);
    
    		if (value == cfg)
    			break;
    		if (retry++ >= 20)
    			return -ENODEV;
    		msleep(50);
    	}
    	
    //      status = gs2971_write_register(spi, GS2971_VCFG2, GS_VCFG2_DS_SWAP_3G);
    	status = gs2971_write_register(spi, GS2971_VCFG2, 0);
    	if (status)
    		return status;
    
    	status = gs2971_write_register(spi, GS2971_IO_CONFIG,
    				       (GS_IOCFG_HSYNC << 0) | (GS_IOCFG_VSYNC
    								<< 5) |
    				       (GS_IOCFG_DE << 10));
    	if (status)
    		return status;
    
    	status = gs2971_write_register(spi, GS2971_IO_CONFIG2,
    				       (GS_IOCFG_LOCKED << 0) | (GS_IOCFG_Y_ANC
    								 << 5) |
    				       (GS_IOCFG_DATA_ERROR << 10));
    	if (status)
    		return status;
    
    	status =
    	    gs2971_write_register(spi, GS2971_TIM_861_CFG, GS_TIMCFG_TRS_861);		
    	if (status)
    		return status;
    //	status =gs2971_write_register(spi, GS2971_RATE_SEL, 0x00);		//cispl
    	for(i=0;i<38;i++)
    	{
    		gs2971_read_register(spi, i, &value);
    		dev_err(&spi->dev, "register %02x = %08x\n",i,(unsigned int)value);
    	}
    #if defined(GS2971_ENABLE_ANCILLARY_DATA)
    	gs2971_init_ancillary(spi);
    #endif
    
    #if 0
    	if (gs2971_timer.function == NULL) {
    		init_timer(&gs2971_timer);
    		gs2971_timer.function = gs2971_timer_function;
    	}
    	mod_timer(&gs2971_timer, jiffies + msecs_to_jiffies(gs2971_timeout_ms));
    #endif
    	return status;
    }
    
    #if 0
    /*!
     * Return attributes of current video standard.
     * Since this device autodetects the current standard, this function also
     * sets the values that need to be changed if the standard changes.
     * There is no set std equivalent function.
     *
     *  @return		None.
     */
    static void gs2971_get_std(struct v4l2_int_device *s, v4l2_std_id * std)
    {
    	pr_debug("-> In function %s\n", __func__);
    }
    #endif
    
    /***********************************************************************
     * IOCTL Functions from v4l2_int_ioctl_desc.
     ***********************************************************************/
    
    /*!
     * ioctl_g_ifparm - V4L2 sensor interface handler for vidioc_int_g_ifparm_num
     * s: pointer to standard V4L2 device structure
     * p: pointer to standard V4L2 vidioc_int_g_ifparm_num ioctl structure
     *
     * Gets slave interface parameters.
     * Calculates the required xclk value to support the requested
     * clock parameters in p.  This value is returned in the p
     * parameter.
     *
     * vidioc_int_g_ifparm returns platform-specific information about the
     * interface settings used by the sensor.
     *
     * Called on open.
     */
    static int ioctl_g_ifparm(struct v4l2_int_device *s, struct v4l2_ifparm *p)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	/* Initialize structure to 0s then set any non-0 values. */
    	memset(p, 0, sizeof(*p));
    	p->u.bt656.clock_curr = sensor->mclk;
    	if (gs->cea861) {
    		p->if_type = V4L2_IF_TYPE_BT656;	/* This is the only possibility. */
    		p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_NOBT_10BIT;
    		p->u.bt656.bt_sync_correct = 1;
    //      	p->u.bt656.nobt_vs_inv = 1;
    		p->u.bt656.nobt_hs_inv = 1;
    	} else {
    		/*
    		 * p->if_type = V4L2_IF_TYPE_BT656_PROGRESSIVE;
    		 * BT.656 - 20/10bit pin low doesn't work because then EAV of
    		 * DS1/2 are also interleaved and imx only recognizes 4 word
    		 * EAV/SAV codes, not 8
    		 */
    		p->if_type = V4L2_IF_TYPE_BT1120_PROGRESSIVE_SDR;
    		p->u.bt656.mode = V4L2_IF_TYPE_BT656_MODE_BT_10BIT;
    		p->u.bt656.bt_sync_correct = 0;	// Use embedded sync
    		p->u.bt656.nobt_vs_inv = 1;
    //		p->u.bt656.nobt_hs_inv = 1;
    	}
    	p->u.bt656.latch_clk_inv = 0;	/* pixel clk polarity */
    	p->u.bt656.clock_min = 6000000;
    	p->u.bt656.clock_max = 180000000;
    	return 0;
    }
    
    static int ioctl_s_power(struct v4l2_int_device *s, int on)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	if (on && !sensor->on) {
    		power_control(gs, 1);
    	} else if (!on && sensor->on) {
    		power_control(gs, 0);
    	}
    	return 0;
    }
    
    /*!
     * ioctl_g_parm - V4L2 sensor interface handler for VIDIOC_G_PARM ioctl
     * @s: pointer to standard V4L2 device structure
     * @a: pointer to standard V4L2 VIDIOC_G_PARM ioctl structure
     *
     * Returns the sensor's video CAPTURE parameters.
     */
    static int ioctl_g_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	struct v4l2_captureparm *cparm = &a->parm.capture;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	switch (a->type) {
    		/* These are all the possible cases. */
    	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
    		pr_debug("   type is V4L2_BUF_TYPE_VIDEO_CAPTURE\n");
    		memset(a, 0, sizeof(*a));
    		a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
    		cparm->capability = sensor->streamcap.capability;
    		cparm->timeperframe = sensor->streamcap.timeperframe;
    		cparm->capturemode = sensor->streamcap.capturemode;
    		break;
    
    	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
    	case V4L2_BUF_TYPE_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_VBI_OUTPUT:
    	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
    		break;
    
    	default:
    		pr_debug("ioctl_g_parm:type is unknown %d\n", a->type);
    		break;
    	}
    	return 0;
    }
    
    /*!
     * ioctl_s_parm - V4L2 sensor interface handler for VIDIOC_S_PARM ioctl
     * @s: pointer to standard V4L2 device structure
     * @a: pointer to standard V4L2 VIDIOC_S_PARM ioctl structure
     *
     * Configures the sensor to use the input parameters, if possible.  If
     * not possible, reverts to the old parameters and returns the
     * appropriate error code.
     *
     * This driver cannot change these settings.
     */
    static int ioctl_s_parm(struct v4l2_int_device *s, struct v4l2_streamparm *a)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
    	int ret = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	/* Make sure power on */
    	power_control(gs, 1);
    
    	switch (a->type) {
    		/* This is the only case currently handled. */
    	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
    		/* Check that the new frame rate is allowed. */
    		if ((timeperframe->numerator == 0) ||
    		    (timeperframe->denominator == 0)) {
    			timeperframe->denominator =
    			    gs2971_framerates[gs2971_default_fps];
    			timeperframe->numerator = 1;
    			pr_warning("   Setting framerate to default (%dfps)!\n",
    				   gs2971_framerates[gs2971_default_fps]);
    		} else if (timeperframe->denominator !=
    			   gs2971_framerates[gs->framerate]) {
    			pr_warning
    			    ("   Input framerate is %dfps and you are trying to set %dfps!\n",
    			     gs2971_framerates[gs->framerate],
    			     timeperframe->denominator);
    		}
    		sensor->streamcap.timeperframe = *timeperframe;
    		sensor->streamcap.capturemode =
    		    (u32) a->parm.capture.capturemode;
    		break;
    
    		/* These are all the possible cases. */
    	case V4L2_BUF_TYPE_VIDEO_OUTPUT:
    	case V4L2_BUF_TYPE_VIDEO_OVERLAY:
    	case V4L2_BUF_TYPE_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_VBI_OUTPUT:
    	case V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:
    	case V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:
    		pr_debug("   type is not V4L2_BUF_TYPE_VIDEO_CAPTURE but %d\n",
    			 a->type);
    		ret = -EINVAL;
    		break;
    
    	default:
    		pr_debug("   type is unknown - %d\n", a->type);
    		ret = -EINVAL;
    		break;
    	}
    	return ret;
    }
    
    /*!
     * ioctl_g_fmt_cap - V4L2 sensor interface handler for ioctl_g_fmt_cap
     * @s: pointer to standard V4L2 device structure
     * @f: pointer to standard V4L2 v4l2_format structure
     *
     * Returns the sensor's current pixel format in the v4l2_format
     * parameter.
     */
    static int ioctl_g_fmt_cap(struct v4l2_int_device *s, struct v4l2_format *f)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	v4l2_std_id std = V4L2_STD_UNKNOWN;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	power_control(gs, 1);
    	switch (f->type) {
    	case V4L2_BUF_TYPE_VIDEO_CAPTURE:
    		get_std(s, &std);
    		f->fmt.pix = sensor->pix;
    		break;
    
    	case V4L2_BUF_TYPE_SENSOR:
    		pr_debug("%s: left=%d, top=%d, %dx%d\n", __func__,
    			sensor->spix.left, sensor->spix.top,
    			sensor->spix.swidth, sensor->spix.sheight);
    		f->fmt.spix = sensor->spix;
    		break;
    
    	case V4L2_BUF_TYPE_PRIVATE:
    		get_std(s, &std);
    //              f->fmt.pix.pixelformat = (u32)std;
    		break;
    
    	default:
    		f->fmt.pix = sensor->pix;
    		break;
    	}
    	return 0;
    }
    
    /*!
     * ioctl_queryctrl - V4L2 sensor interface handler for VIDIOC_QUERYCTRL ioctl
     * @s: pointer to standard V4L2 device structure
     * @qc: standard V4L2 VIDIOC_QUERYCTRL ioctl structure
     *
     * If the requested control is supported, returns the control information
     * from the video_control[] array.  Otherwise, returns -EINVAL if the
     * control is not supported.
     */
    static int ioctl_queryctrl(struct v4l2_int_device *s, struct v4l2_queryctrl *qc)
    {
    	pr_debug("-> In function %s\n", __func__);
    	return -EINVAL;
    }
    
    /*!
     * ioctl_g_ctrl - V4L2 sensor interface handler for VIDIOC_G_CTRL ioctl
     * @s: pointer to standard V4L2 device structure
     * @vc: standard V4L2 VIDIOC_G_CTRL ioctl structure
     *
     * If the requested control is supported, returns the control's current
     * value from the video_control[] array.  Otherwise, returns -EINVAL
     * if the control is not supported.
     */
    static int ioctl_g_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    	int ret = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	switch (vc->id) {
    	case V4L2_CID_BRIGHTNESS:
    		vc->value = sensor->brightness;
    		break;
    	case V4L2_CID_HUE:
    		vc->value = sensor->hue;
    		break;
    	case V4L2_CID_CONTRAST:
    		vc->value = sensor->contrast;
    		break;
    	case V4L2_CID_SATURATION:
    		vc->value = sensor->saturation;
    		break;
    	case V4L2_CID_RED_BALANCE:
    		vc->value = sensor->red;
    		break;
    	case V4L2_CID_BLUE_BALANCE:
    		vc->value = sensor->blue;
    		break;
    	case V4L2_CID_EXPOSURE:
    		vc->value = sensor->ae_mode;
    		break;
    	default:
    		ret = -EINVAL;
    	}
    	return ret;
    }
    
    /*!
     * ioctl_s_ctrl - V4L2 sensor interface handler for VIDIOC_S_CTRL ioctl
     * @s: pointer to standard V4L2 device structure
     * @vc: standard V4L2 VIDIOC_S_CTRL ioctl structure
     *
     * If the requested control is supported, sets the control's current
     * value in HW (and updates the video_control[] array).  Otherwise,
     * returns -EINVAL if the control is not supported.
     */
    static int ioctl_s_ctrl(struct v4l2_int_device *s, struct v4l2_control *vc)
    {
    	struct gs2971_priv *gs = s->priv;
    //	struct sensor_data *sensor = &gs->sensor;
    	int retval = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	///* Make sure power on */
    	power_control(gs, 1);
    
    	switch (vc->id) {
    	case V4L2_CID_BRIGHTNESS:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_BRIGHTNESS\n");
    		break;
    	case V4L2_CID_CONTRAST:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_CONTRAST\n");
    		break;
    	case V4L2_CID_SATURATION:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_SATURATION\n");
    		break;
    	case V4L2_CID_HUE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_HUE\n");
    		break;
    	case V4L2_CID_AUTO_WHITE_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_AUTO_WHITE_BALANCE\n");
    		break;
    	case V4L2_CID_DO_WHITE_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_DO_WHITE_BALANCE\n");
    		break;
    	case V4L2_CID_RED_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_RED_BALANCE\n");
    		break;
    	case V4L2_CID_BLUE_BALANCE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_BLUE_BALANCE\n");
    		break;
    	case V4L2_CID_GAMMA:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_GAMMA\n");
    		break;
    	case V4L2_CID_EXPOSURE:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_EXPOSURE\n");
    		break;
    	case V4L2_CID_AUTOGAIN:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_AUTOGAIN\n");
    		break;
    	case V4L2_CID_GAIN:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_GAIN\n");
    		break;
    	case V4L2_CID_HFLIP:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_HFLIP\n");
    		break;
    	case V4L2_CID_VFLIP:
    		dev_dbg(&spidata->spi->dev, "   V4L2_CID_VFLIP\n");
    		break;
    	default:
    		dev_dbg(&spidata->spi->dev, "   Default case\n");
    		retval = -EPERM;
    		break;
    	}
    	return retval;
    }
    
    /*!
     * ioctl_enum_framesizes - V4L2 sensor interface handler for
     *			   VIDIOC_ENUM_FRAMESIZES ioctl
     * @s: pointer to standard V4L2 device structure
     * @fsize: standard V4L2 VIDIOC_ENUM_FRAMESIZES ioctl structure
     *
     * Return 0 if successful, otherwise -EINVAL.
     */
    static int ioctl_enum_framesizes(struct v4l2_int_device *s,
    				 struct v4l2_frmsizeenum *fsize)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	if (fsize->index > gs2971_mode_MAX || gs->mode > gs2971_mode_MAX)
    		return -EINVAL;
    
    	fsize->pixel_format = sensor->pix.pixelformat;
    	fsize->discrete.width = gs2971_res[gs->mode].width;
    	fsize->discrete.height = gs2971_res[gs->mode].height;
    	return 0;
    }
    
    /*!
     * ioctl_g_chip_ident - V4L2 sensor interface handler for
     *			VIDIOC_DBG_G_CHIP_IDENT ioctl
     * @s: pointer to standard V4L2 device structure
     * @id: pointer to int
     *
     * Return 0.
     */
    static int ioctl_g_chip_ident(struct v4l2_int_device *s, int *id)
    {
    	pr_debug("-> In function %s\n", __func__);
    
    	((struct v4l2_dbg_chip_ident *)id)->match.type =
    	    V4L2_CHIP_MATCH_I2C_DRIVER;
    	strcpy(((struct v4l2_dbg_chip_ident *)id)->match.name, "gs2971_video");
    
    	return 0;
    }
    
    /*!
     * ioctl_enum_fmt_cap - V4L2 sensor interface handler for VIDIOC_ENUM_FMT
     * @s: pointer to standard V4L2 device structure
     * @fmt: pointer to standard V4L2 fmt description structure
     *
     * Return 0.
     */
    static int ioctl_enum_fmt_cap(struct v4l2_int_device *s,
    			      struct v4l2_fmtdesc *fmt)
    {
    	struct gs2971_priv *gs = s->priv;
    	struct sensor_data *sensor = &gs->sensor;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	if (fmt->index > 0)
    		return -EINVAL;
    	fmt->pixelformat = sensor->pix.pixelformat;	//gs->pix.pixelformat;
    	return 0;
    }
    
    /*!
     * ioctl_init - V4L2 sensor interface handler for VIDIOC_INT_INIT
     * @s: pointer to standard V4L2 device structure
     */
    static int ioctl_init(struct v4l2_int_device *s)
    {
    	pr_debug("-> In function %s\n", __func__);
    	return 0;
    }
    
    /*!
     * ioctl_dev_init - V4L2 sensor interface handler for vidioc_int_dev_init_num
     * @s: pointer to standard V4L2 device structure
     *
     * Initialise the device when slave attaches to the master.
     */
    static int ioctl_dev_init(struct v4l2_int_device *s)
    {
    	pr_debug("-> In function %s\n", __func__);
    	return 0;
    }
    
    /*!
     * This structure defines all the ioctls for this module.
     */
    static struct v4l2_int_ioctl_desc gs2971_ioctl_desc[] = {
    
    	{vidioc_int_dev_init_num, (v4l2_int_ioctl_func *) ioctl_dev_init},
    	{vidioc_int_s_power_num, (v4l2_int_ioctl_func *) ioctl_s_power},
    	{vidioc_int_g_ifparm_num, (v4l2_int_ioctl_func *) ioctl_g_ifparm},
    	{vidioc_int_init_num, (v4l2_int_ioctl_func *) ioctl_init},
    
    	/*!
    	 * VIDIOC_ENUM_FMT ioctl for the CAPTURE buffer type.
    	 */
    	{vidioc_int_enum_fmt_cap_num,
    	 (v4l2_int_ioctl_func *) ioctl_enum_fmt_cap},
    	{vidioc_int_g_fmt_cap_num, (v4l2_int_ioctl_func *) ioctl_g_fmt_cap},
    	{vidioc_int_g_parm_num, (v4l2_int_ioctl_func *) ioctl_g_parm},
    	{vidioc_int_s_parm_num, (v4l2_int_ioctl_func *) ioctl_s_parm},
    	{vidioc_int_queryctrl_num, (v4l2_int_ioctl_func *) ioctl_queryctrl},
    	{vidioc_int_g_ctrl_num, (v4l2_int_ioctl_func *) ioctl_g_ctrl},
    	{vidioc_int_s_ctrl_num, (v4l2_int_ioctl_func *) ioctl_s_ctrl},
    	{vidioc_int_enum_framesizes_num,
    	 (v4l2_int_ioctl_func *) ioctl_enum_framesizes},
    	{vidioc_int_g_chip_ident_num,
    	 (v4l2_int_ioctl_func *) ioctl_g_chip_ident},
    };
    
    static struct v4l2_int_slave gs2971_slave = {
    	.ioctls = gs2971_ioctl_desc,
    	.num_ioctls = ARRAY_SIZE(gs2971_ioctl_desc),
    };
    
    static struct v4l2_int_device gs2971_int_device = {
    	.module = THIS_MODULE,
    	.name = "gs2971",
    	.type = v4l2_int_type_slave,
    	.u = {
    	      .slave = &gs2971_slave,
    	      },
    };
    static int gs_g_register(struct v4l2_subdev *sd,
    		  struct v4l2_dbg_register *reg)
    {
    	struct spi_device *spi = v4l2_get_subdevdata(sd);
    	u16 val;
    	int ret;
    
    	ret = gs2971_read_register(spi, reg->reg & 0xFFFF, &val);
    	reg->val = val;
    	reg->size = 2;
    	return ret;
    }
    static int gs_s_register(struct v4l2_subdev *sd,
    		  const struct v4l2_dbg_register *reg)
    {
    	struct spi_device *spi = v4l2_get_subdevdata(sd);
    
    	return gs2971_write_register(spi, reg->reg & 0xFFFF, reg->val & 0xFFFF);
    
    }
    /*static inline struct gs2971_spidata *to_gs(struct v4l2_subdev *sd)
    {
    	return container_of(sd, struct gs2971_spidata, sd);
    }
    static int gs_s_dv_timings(struct v4l2_subdev *sd,
    		    struct v4l2_dv_timings *timings)
    {
    	struct gs2971_spidata *gs = to_gs(sd);
    	int reg_value;
    
    	reg_value = get_register_timings(timings);
    	if (reg_value == 0x0)
    		return -EINVAL;
    
    	gs->current_timings = *timings;
    	return 0;
    }
    static int gs_g_dv_timings(struct v4l2_subdev *sd,
    		    struct v4l2_dv_timings *timings)
    {
    	struct gs *gs = to_gs(sd);
    
    	*timings = gs->current_timings;
    	return 0;
    }
    static int gs_g_input_status(struct v4l2_subdev *sd, u32 *status)
    {
    	struct gs2971_spidata *gs = to_gs(sd);
    	u16 reg_value, i;
    	int ret;
    */
    	/*
    	 * Check if the component detect a line, a frame or something else
    	 * which looks like a video signal activity.
    	 */
    /*	for (i = 0; i < 4; i++) {
    		ret = gs2971_read_register(gs->pdev,
    				       REG_LINES_PER_FRAME + i, &reg_value);
    		if (reg_value)
    			break;
    		if (ret) {
    			*status = V4L2_IN_ST_NO_POWER;
    			return ret;
    		}
    	}
    */
    	/* If no register reports a video signal */
    /*	if (i >= 4)
    		*status |= V4L2_IN_ST_NO_SIGNAL;
    
    	ret = gs_read_register(gs->pdev, REG_STATUS, &reg_value);
    	if (!(reg_value & MASK_H_LOCK))
    		*status |=  V4L2_IN_ST_NO_H_LOCK;
    	if (!(reg_value & MASK_V_LOCK))
    		*status |=  V4L2_IN_ST_NO_V_LOCK;
    	if (!(reg_value & MASK_STD_LOCK))
    		*status |=  V4L2_IN_ST_NO_STD_LOCK;
    
    	return ret;
    }
    static int gs_query_dv_timings(struct v4l2_subdev *sd,
    			struct v4l2_dv_timings *timings)
    {
    	struct gs *gs = to_gs(sd);
    	struct v4l2_dv_timings fmt;
    	u16 reg_value, i;
    	int ret;
    
    	if (gs->enabled)
    		return -EBUSY;
    */
    	/*
    	 * Check if the component detect a line, a frame or something else
    	 * which looks like a video signal activity.
    	 */
    /*	for (i = 0; i < 4; i++) {
    		gs_read_register(gs->pdev, REG_LINES_PER_FRAME + i, &reg_value);
    		if (reg_value)
    			break;
    	}
    */
    	/* If no register reports a video signal */
    /*	if (i >= 4)
    		return -ENOLINK;
    
    	gs_read_register(gs->pdev, REG_STATUS, &reg_value);
    	if (!(reg_value & MASK_H_LOCK) || !(reg_value & MASK_V_LOCK))
    		return -ENOLCK;
    	if (!(reg_value & MASK_STD_LOCK))
    		return -ERANGE;
    
    	ret = gs_status_format(reg_value, &fmt);
    
    	if (ret < 0)
    		return ret;
    
    	*timings = fmt;
    	return 0;
    }
    static int gs_s_stream(struct v4l2_subdev *sd, int enable)
    {
    	struct gs *gs = to_gs(sd);
    	int reg_value;
    
    	if (gs->enabled == enable)
    		return 0;
    
    	gs->enabled = enable;
    
    	if (enable) {
    */		/* To force the specific format */
    //		reg_value = get_register_timings(&gs->current_timings);
    //		return gs_write_register(gs->pdev, REG_FORCE_FMT, reg_value);
    //	}
    
    	/* To renable auto-detection mode */
    //	return gs_write_register(gs->pdev, REG_FORCE_FMT, 0x0);
    //}
    
    static const struct v4l2_subdev_core_ops gs2971_core_ops = {
    #ifdef CONFIG_VIDEO_ADV_DEBUG
    	.g_register = gs_g_register,
    	.s_register = gs_s_register,
    #endif
    };
    
    static const struct v4l2_subdev_video_ops gs2971_video_ops = {
    //	.g_std = get_std,
    //	.g_fmt_cap = ioctl_g_fmt_cap,
    //	.g_parm = ioctl_g_parm,
    //	.s_parm = ioctl_s_parm,
    //	.queryctrl = ioctl_queryctrl,
    //	.enum_framesizes = ioctl_enum_framesizes,
    };
    
    static const struct v4l2_subdev_pad_ops gs2971_pad_ops = {
    //	.enum_dv_timings = ioctl_dev_init,
    //	.dv_timings_cap = ioctl_init,
    };
    static const struct v4l2_subdev_ops gs2971_ops = {
    	.core = &gs2971_core_ops,
    	.video = &gs2971_video_ops,
    	.pad = &gs2971_pad_ops,
    };
    
    /*!
     * GS2971 SPI probe function.
     * Function set in spi_driver struct.
     * Called by insmod.
     *
     *  @param *spi	SPI device descriptor.
     *
     *  @return		Error code indicating success or failure.
     */
    static int gs2971_probe(struct spi_device *spi)
    {
    	struct v4l2_subdev *sd;
    	struct device *dev = &spi->dev;
    	struct gs2971_priv *gs;
    	struct sensor_data *sensor;
    	struct pinctrl_state *pins;
    
    	int ret = 0;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	gs = kzalloc(sizeof(*gs), GFP_KERNEL);
    	if (!gs)
    			return -ENOMEM;
    
    	/* Allocate driver data */
    	spidata = kzalloc(sizeof(*spidata), GFP_KERNEL);
    	if (!spidata) {
    		ret = -ENOMEM;
    		goto exit;
    	}
    	/* Initialize the driver data */
    	spidata->spi = spi;
    	mutex_init(&spidata->buf_lock);
    	sensor = &gs->sensor;
    
    	/* Set initial values for the sensor struct. */
    	memset(gs, 0, sizeof(*gs));
    	ret = of_property_read_u32(dev->of_node, "mclk", &sensor->mclk);
    	dev_err(dev, "mclk=%x\n",sensor->mclk);
    	if (ret) {
    		dev_err(dev, "mclk missing or invalid\n");
    		goto exit;
    	}
    
    	ret = of_property_read_u32(dev->of_node, "ipu", &sensor->ipu_id);
    	dev_err(dev, "ipu=%x\n",sensor->ipu_id);
    	if (ret) {
    		dev_err(dev, "ipu missing or invalid\n");
    		goto exit;
    	}
    
    	ret = of_property_read_u32(dev->of_node, "csi", &sensor->csi);
    	if (ret) {
    		dev_err(dev, "csi missing or invalid\n");
    		goto exit;
    	}
    
    	ret = of_property_read_u32(dev->of_node, "cea861", &gs->cea861);
    	if (ret) {
    		dev_err(dev, "cea861 missing or invalid\n");
    		goto exit;
    	}
    	pr_info("%s:cea861=%d\n", __func__, gs->cea861);
    
    	/*gs->pinctrl = devm_pinctrl_get(dev);
    	if (IS_ERR(gs->pinctrl)) {
    		ret = PTR_ERR(gs->pinctrl);
    		dev_err(dev, "pinctrl missing or invalid\n");
    		goto exit;
    	}
    
    
    	pins = pinctrl_lookup_state(gs->pinctrl, gs->cea861 ? "cea861" : "no_cea861");
    	if (IS_ERR(pins)) {
    		ret = PTR_ERR(pins);
    		dev_err(dev, "pinctrl lookup state missing or invalid\n");
    		goto exit;
    	}
    
    	ret = pinctrl_select_state(gs->pinctrl, pins);
    	if (ret)
    	{
    		dev_err(dev, "pinctrl select state missing or invalid\n");
    		goto exit;
    	}*/
    	sensor->pix.pixelformat = YUV_FORMAT(gs);
    	sensor->pix.width = gs2971_res[gs2971_mode_default].width;
    	sensor->pix.height = gs2971_res[gs2971_mode_default].height;
    	sensor->streamcap.capability = V4L2_MODE_HIGHQUALITY |
    	    V4L2_CAP_TIMEPERFRAME;
    	sensor->streamcap.capturemode = 1;
    	sensor->streamcap.timeperframe.denominator = DEFAULT_FPS;
    	sensor->streamcap.timeperframe.numerator = 1;
    
    	dev_err(dev, "pixelformat=%d\n",sensor->pix.pixelformat);
    	dev_err(dev, "width=%d\n",sensor->pix.width);
    	dev_err(dev, "height=%d\n",sensor->pix.height);
    	dev_err(dev, "capability=%x\n",sensor->streamcap.capability );
    //	dev_err(dev, "capturemode=%d\n",sensor->pix.capturemode);
    //	dev_err(dev, "denominator=%d\n",sensor->streamcap.timeperframe.denominator);
    //	dev_err(dev, "numerator=%d\n",sensor->streamcap.timeperframe.numerator);
    	
    	//sensor->pix.priv = 1;  /* 1 is used to indicate TV in */
    	/*ret = gs2971_get_gpios(gs, dev);
    	if (ret)
    	{
    		dev_err(dev, "get gpio missing or invalid\n");	
    		goto exit;
    	}*/
    	power_control(gs, 1);
    	gs2971_int_device.priv = gs;
    
    	ret = gs2971_initialize(gs, spi);
    	if (ret)
    	{	
    		dev_err(dev, "gs2971 init missing or invalid\n");	
    		goto exit;
    	}
    	power_control(gs, 0);
    
    	spidata->spi = spi;
    	sd = &spidata->sd;
    	//v4l2_int_device_register(&gs2971_int_device);
    	//pr_debug("%s: %d\n", __func__, on);
    	//pr_err("v4l2_int_device_register end\n");
    	//ret = video_register_device(gs->video_dev, VFL_TYPE_GRABBER, -1);
    	//if (ret < 0)
    	//{
    	//	pr_err("ERROR: v4l2 capture: video_register_device failed\n");
    		//goto error_unregister_device;
    	//}
    	/*if (video_register_device(gs->video_dev, VFL_TYPE_GRABBER, -1)== -1) 
    	{
    		kfree(gs);
    		gs = NULL;
    		pr_err("ERROR: v4l2 capture: video_register_device failed\n");
    		return -1;
    	}*/
    	//v4l2_device_register(&spi->dev, &spi->sd);
    	v4l2_spi_subdev_init(sd, spi, &gs2971_ops);		
    	v4l2_subdev_init(sd, &gs2971_ops);
    	ret = v4l2_async_register_subdev(sd);
     exit:
    	if (ret) {
    		kfree(spidata);
    		kfree(gs);
    		pr_err("gs2971_probe returns %d\n", ret);
    	}
    	return ret;
    
    }
    
    static int gs2971_remove(struct spi_device *spi)
    {
    	struct v4l2_subdev *sd;
    	pr_debug("-> In function %s\n", __func__);
    	kfree(gs2971_int_device.priv);
    	kfree(spidata);
    	v4l2_int_device_unregister(&gs2971_int_device);
    	//v4l2_device_unregister_subdev(sd);
    	v4l2_async_unregister_subdev(sd);
    	return 0;
    }
    
    static const struct of_device_id gs2971_dt_ids[] = {
    	{
    		.compatible = "gn,gs2971",
    	}, {
    		/* sentinel */
    	}
    };
    MODULE_DEVICE_TABLE(of, gs2971_dt_ids);
    
    static struct spi_driver gs2971_spi = {
    	.driver = {
    		   .name = DRIVER_NAME,
    		   .bus = &spi_bus_type,
    		   .owner = THIS_MODULE,
    		   .of_match_table = gs2971_dt_ids,
    		   },
    	.probe = gs2971_probe,
    	.remove = gs2971_remove,
    };
    
    /*!
     * gs2971 init function.
     * Called on insmod.
     *
     * @return    Error code indicating success or failure.
     */
    static int __init gs2971_init(void)
    {
    	int ret;
    
    	pr_debug("-> In function %s\n", __func__);
    
    	ret = spi_register_driver(&gs2971_spi);
    
    	return ret;
    }
    
    /*!
     * gs2971 cleanup function.
     * Called on rmmod.
     *
     * @return   Error code indicating success or failure.
     */
    static void __exit gs2971_exit(void)
    {
    	pr_debug("-> In function %s\n", __func__);
    
    	spi_unregister_driver(&gs2971_spi);
    }
    
    module_init(gs2971_init);
    module_exit(gs2971_exit);
    MODULE_DESCRIPTION("gs2971 video input Driver");
    MODULE_LICENSE("GPL");
    MODULE_VERSION("1.0");
    MODULE_ALIAS("CSI");

    And another file i am refering (linux/driver/media/v4l2-core/v4l2-async.c)

    /*
     * V4L2 asynchronous subdevice registration API
     *
     * Copyright (C) 2012-2013, Guennadi Liakhovetski <g.liakhovetski@gmx.de>
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU General Public License version 2 as
     * published by the Free Software Foundation.
     */
    
    #include <linux/device.h>
    #include <linux/err.h>
    #include <linux/i2c.h>
    #include <linux/list.h>
    #include <linux/mm.h>
    #include <linux/module.h>
    #include <linux/mutex.h>
    #include <linux/of.h>
    #include <linux/platform_device.h>
    #include <linux/slab.h>
    #include <linux/types.h>
    
    #include <media/v4l2-async.h>
    #include <media/v4l2-device.h>
    #include <media/v4l2-fwnode.h>
    #include <media/v4l2-subdev.h>
    
    static int v4l2_async_notifier_call_bound(struct v4l2_async_notifier *n,struct v4l2_subdev *subdev,struct v4l2_async_subdev *asd)
    {
    	struct device *dev;
    	dev_err(dev,"v4l2_async_notifier_call_bound start\n");
    	if (!n->ops || !n->ops->bound)
    		return 0;
    	dev_err(dev,"v4l2_async_notifier_call_bound end\n");
    	return n->ops->bound(n, subdev, asd);
    }
    
    static void v4l2_async_notifier_call_unbind(struct v4l2_async_notifier *n,
    					    struct v4l2_subdev *subdev,
    					    struct v4l2_async_subdev *asd)
    {
    	if (!n->ops || !n->ops->unbind)
    		return;
    
    	n->ops->unbind(n, subdev, asd);
    }
    
    static int v4l2_async_notifier_call_complete(struct v4l2_async_notifier *n)
    {
    	if (!n->ops || !n->ops->complete)
    		return 0;
    
    	return n->ops->complete(n);
    }
    
    static bool match_i2c(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
    {
    #if IS_ENABLED(CONFIG_I2C)
    	struct i2c_client *client = i2c_verify_client(sd->dev);
    	return client &&
    		asd->match.i2c.adapter_id == client->adapter->nr &&
    		asd->match.i2c.address == client->addr;
    #else
    	return false;
    #endif
    }
    
    static bool match_devname(struct v4l2_subdev *sd,
    			  struct v4l2_async_subdev *asd)
    {
    	return !strcmp(asd->match.device_name, dev_name(sd->dev));
    }
    
    static bool match_fwnode(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
    {
    	return sd->fwnode == asd->match.fwnode;
    }
    
    static bool match_custom(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
    {
    	if (!asd->match.custom.match)
    		/* Match always */
    		return true;
    
    	return asd->match.custom.match(sd->dev, asd);
    }
    
    static LIST_HEAD(subdev_list);
    static LIST_HEAD(notifier_list);
    static DEFINE_MUTEX(list_lock);
    
    static struct v4l2_async_subdev *v4l2_async_find_match(struct v4l2_async_notifier *notifier, struct v4l2_subdev *sd)
    {
    	bool (*match)(struct v4l2_subdev *, struct v4l2_async_subdev *);
    	struct v4l2_async_subdev *asd;
    	struct device *dev;
    	dev_err(dev,"v4l2_async_find_match\n");
    
    	list_for_each_entry(asd, &notifier->waiting, list) {
    		/* bus_type has been verified valid before */
    		switch (asd->match_type) {
    		case V4L2_ASYNC_MATCH_CUSTOM:
    			match = match_custom;
    			dev_err(dev,"v4l2_async_find_match match_custom\n");
    			break;
    		case V4L2_ASYNC_MATCH_DEVNAME:
    			match = match_devname;
    			dev_err(dev,"v4l2_async_find_match match_devname\n");
    			break;
    		case V4L2_ASYNC_MATCH_I2C:
    			match = match_i2c;
    			dev_err(dev,"v4l2_async_find_match match_i2c\n");
    			break;
    		case V4L2_ASYNC_MATCH_FWNODE:
    			match = match_fwnode;
    			dev_err(dev,"v4l2_async_find_match match_fwnode\n");
    			break;
    		default:
    			/* Cannot happen, unless someone breaks us */
    			WARN_ON(true);
    			dev_err(dev,"v4l2_async_find_match WARN_ON\n");
    			return NULL;
    		}
    
    		/* match cannot be NULL here */
    		if (match(sd, asd))
    		{
    			dev_err(dev,"v4l2_async_find_match match_fwnode1\n");
    			return asd;
    		}
    	}
    	dev_err(dev,"v4l2_async_find_match after match\n");
    	return NULL;
    }
    
    /* Find the sub-device notifier registered by a sub-device driver. */
    static struct v4l2_async_notifier *v4l2_async_find_subdev_notifier(
    	struct v4l2_subdev *sd)
    {
    	struct v4l2_async_notifier *n;
    
    	list_for_each_entry(n, &notifier_list, list)
    		if (n->sd == sd)
    			return n;
    
    	return NULL;
    }
    
    /* Get v4l2_device related to the notifier if one can be found. */
    static struct v4l2_device *v4l2_async_notifier_find_v4l2_dev(
    	struct v4l2_async_notifier *notifier)
    {
    	struct device *dev;
    	dev_err(dev,"v4l2_async_notifier_find_v4l2_dev1\n");
    	while (notifier->parent)
    		notifier = notifier->parent;
    	dev_err(dev,"v4l2_async_notifier_find_v4l2_dev2\n");
    	return notifier->v4l2_dev;
    }
    
    /*
     * Return true if all child sub-device notifiers are complete, false otherwise.
     */
    static bool v4l2_async_notifier_can_complete(
    	struct v4l2_async_notifier *notifier)
    {
    	struct v4l2_subdev *sd;
    
    	if (!list_empty(&notifier->waiting))
    		return false;
    
    	list_for_each_entry(sd, &notifier->done, async_list) {
    		struct v4l2_async_notifier *subdev_notifier =
    			v4l2_async_find_subdev_notifier(sd);
    
    		if (subdev_notifier &&
    		    !v4l2_async_notifier_can_complete(subdev_notifier))
    			return false;
    	}
    
    	return true;
    }
    
    /*
     * Complete the master notifier if possible. This is done when all async
     * sub-devices have been bound; v4l2_device is also available then.
     */
    static int v4l2_async_notifier_try_complete(
    	struct v4l2_async_notifier *notifier)
    {
    	/* Quick check whether there are still more sub-devices here. */
    	if (!list_empty(&notifier->waiting))
    		return 0;
    
    	/* Check the entire notifier tree; find the root notifier first. */
    	while (notifier->parent)
    		notifier = notifier->parent;
    
    	/* This is root if it has v4l2_dev. */
    	if (!notifier->v4l2_dev)
    		return 0;
    
    	/* Is everything ready? */
    	if (!v4l2_async_notifier_can_complete(notifier))
    		return 0;
    
    	return v4l2_async_notifier_call_complete(notifier);
    }
    
    static int v4l2_async_notifier_try_all_subdevs(
    	struct v4l2_async_notifier *notifier);
    
    static int v4l2_async_match_notify(struct v4l2_async_notifier *notifier,
    				   struct v4l2_device *v4l2_dev,
    				   struct v4l2_subdev *sd,
    				   struct v4l2_async_subdev *asd)
    {
    	struct v4l2_async_notifier *subdev_notifier;
    	int ret;
    	struct device *dev;
    	dev_err(dev,"v4l2_async_match_notify\n");
    
    	dev_err(dev,"v4l2_async_match_notify v4l2_async_notifier_call_bound start\n");
    	ret = v4l2_async_notifier_call_bound(notifier, sd, asd);
    	dev_err(dev,"v4l2_async_match_notify v4l2_async_notifier_call_bound end\n");
    	if (ret < 0) {
    		dev_err(dev,"v4l2_async_match_notify v4l2_device_unregister_subdev\n");
    		v4l2_device_unregister_subdev(sd);
    		return ret;
    	}
    	ret = v4l2_device_register_subdev(v4l2_dev, sd);
    	dev_err(dev,"v4l2_async_match_notify v4l2_device_register_subdev\n");
    	if (ret < 0)
    		return ret;
    	/* Remove from the waiting list */
    	list_del(&asd->list);
    	sd->asd = asd;
    	sd->notifier = notifier;
    
    	/* Move from the global subdevice list to notifier's done */
    	list_move(&sd->async_list, &notifier->done);
    
    	/*
    	 * See if the sub-device has a notifier. If not, return here.
    	 */
    		dev_err(dev,"v4l2_async_match_notify v4l2_async_find_subdev_notifier start\n");
    	subdev_notifier = v4l2_async_find_subdev_notifier(sd);
    		dev_err(dev,"v4l2_async_match_notify v4l2_async_find_subdev_notifier end\n");
    	if (!subdev_notifier || subdev_notifier->parent)
    		return 0;
    
    	/*
    	 * Proceed with checking for the sub-device notifier's async
    	 * sub-devices, and return the result. The error will be handled by the
    	 * caller.
    	 */
    	subdev_notifier->parent = notifier;
    	dev_err(dev,"v4l2_async_match_notify end\n");
    	return v4l2_async_notifier_try_all_subdevs(subdev_notifier);
    }
    
    /* Test all async sub-devices in a notifier for a match. */
    static int v4l2_async_notifier_try_all_subdevs(
    	struct v4l2_async_notifier *notifier)
    {
    	struct v4l2_device *v4l2_dev =
    		v4l2_async_notifier_find_v4l2_dev(notifier);
    	struct v4l2_subdev *sd;
    
    	if (!v4l2_dev)
    		return 0;
    
    again:
    	list_for_each_entry(sd, &subdev_list, async_list) {
    		struct v4l2_async_subdev *asd;
    		int ret;
    
    		asd = v4l2_async_find_match(notifier, sd);
    		if (!asd)
    			continue;
    
    		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
    		if (ret < 0)
    			return ret;
    
    		/*
    		 * v4l2_async_match_notify() may lead to registering a
    		 * new notifier and thus changing the async subdevs
    		 * list. In order to proceed safely from here, restart
    		 * parsing the list from the beginning.
    		 */
    		goto again;
    	}
    
    	return 0;
    }
    
    static void v4l2_async_cleanup(struct v4l2_subdev *sd)
    {
    	v4l2_device_unregister_subdev(sd);
    	/* Subdevice driver will reprobe and put the subdev back onto the list */
    	list_del_init(&sd->async_list);
    	sd->asd = NULL;
    }
    
    /* Unbind all sub-devices in the notifier tree. */
    static void v4l2_async_notifier_unbind_all_subdevs(
    	struct v4l2_async_notifier *notifier)
    {
    	struct v4l2_subdev *sd, *tmp;
    
    	list_for_each_entry_safe(sd, tmp, &notifier->done, async_list) {
    		struct v4l2_async_notifier *subdev_notifier =
    			v4l2_async_find_subdev_notifier(sd);
    
    		if (subdev_notifier)
    			v4l2_async_notifier_unbind_all_subdevs(subdev_notifier);
    
    		v4l2_async_notifier_call_unbind(notifier, sd, sd->asd);
    		v4l2_async_cleanup(sd);
    
    		list_move(&sd->async_list, &subdev_list);
    	}
    
    	notifier->parent = NULL;
    }
    
    /* See if an fwnode can be found in a notifier's lists. */
    static bool __v4l2_async_notifier_fwnode_has_async_subdev(
    	struct v4l2_async_notifier *notifier, struct fwnode_handle *fwnode)
    {
    	struct v4l2_async_subdev *asd;
    	struct v4l2_subdev *sd;
    
    	list_for_each_entry(asd, &notifier->waiting, list) {
    		if (asd->match_type != V4L2_ASYNC_MATCH_FWNODE)
    			continue;
    
    		if (asd->match.fwnode == fwnode)
    			return true;
    	}
    
    	list_for_each_entry(sd, &notifier->done, async_list) {
    		if (WARN_ON(!sd->asd))
    			continue;
    
    		if (sd->asd->match_type != V4L2_ASYNC_MATCH_FWNODE)
    			continue;
    
    		if (sd->asd->match.fwnode == fwnode)
    			return true;
    	}
    
    	return false;
    }
    
    /*
     * Find out whether an async sub-device was set up for an fwnode already or
     * whether it exists in a given notifier before @this_index.
     */
    static bool v4l2_async_notifier_fwnode_has_async_subdev(
    	struct v4l2_async_notifier *notifier, struct fwnode_handle *fwnode,
    	unsigned int this_index)
    {
    	unsigned int j;
    
    	lockdep_assert_held(&list_lock);
    
    	/* Check that an fwnode is not being added more than once. */
    	for (j = 0; j < this_index; j++) {
    		struct v4l2_async_subdev *asd = notifier->subdevs[this_index];
    		struct v4l2_async_subdev *other_asd = notifier->subdevs[j];
    
    		if (other_asd->match_type == V4L2_ASYNC_MATCH_FWNODE &&
    		    asd->match.fwnode ==
    		    other_asd->match.fwnode)
    			return true;
    	}
    
    	/* Check than an fwnode did not exist in other notifiers. */
    	list_for_each_entry(notifier, &notifier_list, list)
    		if (__v4l2_async_notifier_fwnode_has_async_subdev(
    			    notifier, fwnode))
    			return true;
    
    	return false;
    }
    
    static int __v4l2_async_notifier_register(struct v4l2_async_notifier *notifier)
    {
    	struct device *dev =
    		notifier->v4l2_dev ? notifier->v4l2_dev->dev : NULL;
    	struct v4l2_async_subdev *asd;
    	int ret;
    	int i;
    
    	if (notifier->num_subdevs > V4L2_MAX_SUBDEVS)
    		return -EINVAL;
    
    	INIT_LIST_HEAD(&notifier->waiting);
    	INIT_LIST_HEAD(&notifier->done);
    
    	mutex_lock(&list_lock);
    
    	for (i = 0; i < notifier->num_subdevs; i++) {
    		asd = notifier->subdevs[i];
    
    		switch (asd->match_type) {
    		case V4L2_ASYNC_MATCH_CUSTOM:
    		case V4L2_ASYNC_MATCH_DEVNAME:
    		case V4L2_ASYNC_MATCH_I2C:
    			break;
    		case V4L2_ASYNC_MATCH_FWNODE:
    			if (v4l2_async_notifier_fwnode_has_async_subdev(
    				    notifier, asd->match.fwnode, i)) {
    				dev_err(dev,
    					"fwnode has already been registered or in notifier's subdev list\n");
    				ret = -EEXIST;
    				goto err_unlock;
    			}
    			break;
    		default:
    			dev_err(dev, "Invalid match type %u on %p\n",
    				asd->match_type, asd);
    			ret = -EINVAL;
    			goto err_unlock;
    		}
    		list_add_tail(&asd->list, &notifier->waiting);
    	}
    
    	ret = v4l2_async_notifier_try_all_subdevs(notifier);
    	if (ret < 0)
    		goto err_unbind;
    
    	ret = v4l2_async_notifier_try_complete(notifier);
    	if (ret < 0)
    		goto err_unbind;
    
    	/* Keep also completed notifiers on the list */
    	list_add(&notifier->list, &notifier_list);
    
    	mutex_unlock(&list_lock);
    
    	return 0;
    
    err_unbind:
    	/*
    	 * On failure, unbind all sub-devices registered through this notifier.
    	 */
    	v4l2_async_notifier_unbind_all_subdevs(notifier);
    
    err_unlock:
    	mutex_unlock(&list_lock);
    
    	return ret;
    }
    
    int v4l2_async_notifier_register(struct v4l2_device *v4l2_dev,
    				 struct v4l2_async_notifier *notifier)
    {
    	int ret;
    
    	if (WARN_ON(!v4l2_dev || notifier->sd))
    		return -EINVAL;
    
    	notifier->v4l2_dev = v4l2_dev;
    
    	ret = __v4l2_async_notifier_register(notifier);
    	if (ret)
    		notifier->v4l2_dev = NULL;
    
    	return ret;
    }
    EXPORT_SYMBOL(v4l2_async_notifier_register);
    
    int v4l2_async_subdev_notifier_register(struct v4l2_subdev *sd,
    					struct v4l2_async_notifier *notifier)
    {
    	int ret;
    
    	if (WARN_ON(!sd || notifier->v4l2_dev))
    		return -EINVAL;
    
    	notifier->sd = sd;
    
    	ret = __v4l2_async_notifier_register(notifier);
    	if (ret)
    		notifier->sd = NULL;
    
    	return ret;
    }
    EXPORT_SYMBOL(v4l2_async_subdev_notifier_register);
    
    static void __v4l2_async_notifier_unregister(
    	struct v4l2_async_notifier *notifier)
    {
    	if (!notifier || (!notifier->v4l2_dev && !notifier->sd))
    		return;
    
    	v4l2_async_notifier_unbind_all_subdevs(notifier);
    
    	notifier->sd = NULL;
    	notifier->v4l2_dev = NULL;
    
    	list_del(&notifier->list);
    }
    
    void v4l2_async_notifier_unregister(struct v4l2_async_notifier *notifier)
    {
    	mutex_lock(&list_lock);
    
    	__v4l2_async_notifier_unregister(notifier);
    
    	mutex_unlock(&list_lock);
    }
    EXPORT_SYMBOL(v4l2_async_notifier_unregister);
    
    void v4l2_async_notifier_cleanup(struct v4l2_async_notifier *notifier)
    {
    	unsigned int i;
    
    	if (!notifier || !notifier->max_subdevs)
    		return;
    
    	for (i = 0; i < notifier->num_subdevs; i++) {
    		struct v4l2_async_subdev *asd = notifier->subdevs[i];
    
    		switch (asd->match_type) {
    		case V4L2_ASYNC_MATCH_FWNODE:
    			fwnode_handle_put(asd->match.fwnode);
    			break;
    		default:
    			WARN_ON_ONCE(true);
    			break;
    		}
    
    		kfree(asd);
    	}
    
    	notifier->max_subdevs = 0;
    	notifier->num_subdevs = 0;
    
    	kvfree(notifier->subdevs);
    	notifier->subdevs = NULL;
    }
    EXPORT_SYMBOL_GPL(v4l2_async_notifier_cleanup);
    
    int v4l2_async_register_subdev(struct v4l2_subdev *sd)
    {
    	struct v4l2_async_notifier *subdev_notifier;
    	struct v4l2_async_notifier *notifier;
    	struct device *dev;
    	int ret;
    
    	/*
    	 * No reference taken. The reference is held by the device
    	 * (struct v4l2_subdev.dev), and async sub-device does not
    	 * exist independently of the device at any point of time.
    	 */
    	if (!sd->fwnode && sd->dev)
    		sd->fwnode = dev_fwnode(sd->dev);
    
    	mutex_lock(&list_lock);
    
    	INIT_LIST_HEAD(&sd->async_list);
    	dev_err(dev,"v4l2_async_register_subdev Entered\n");
    	list_for_each_entry(notifier, &notifier_list, list) {
    		struct v4l2_device *v4l2_dev =	v4l2_async_notifier_find_v4l2_dev(notifier);
    		dev_err(dev,"v4l2_async_notifier_find_v4l2_dev After loop\n");
    		struct v4l2_async_subdev *asd;
    
    		if (!v4l2_dev)
    		{
    			dev_err(dev,"v4l2_async_register_subdev1\n");
    			continue;
    		}
    		asd = v4l2_async_find_match(notifier, sd);
    		if (!asd)
    		{
    			dev_err(dev,"v4l2_async_register_subdev2\n");
    			continue;
    		}
    		ret = v4l2_async_match_notify(notifier, v4l2_dev, sd, asd);
    		dev_err(dev,"v4l2_async_match_notify completed\n");
    		if (ret)
    		{
    			dev_err(dev,"v4l2_async_register_subdev3\n");
    			goto err_unbind;
    		}
    		ret = v4l2_async_notifier_try_complete(notifier);
    		if (ret)
    		{
    			dev_err(dev,"v4l2_async_register_subdev4\n");
    			goto err_unbind;
    		}
    		goto out_unlock;
    	}
    	dev_err(dev,"v4l2_async_register_subdev\n");
    	/* None matched, wait for hot-plugging */
    	list_add(&sd->async_list, &subdev_list);
    
    out_unlock:
    	mutex_unlock(&list_lock);
    	dev_err(dev,"v4l2_async_register_subdev out_unlock\n");
    	return 0;
    
    err_unbind:
    	/*
    	 * Complete failed. Unbind the sub-devices bound through registering
    	 * this async sub-device.
    	 */
    	dev_err(dev,"v4l2_async_find_subdev_notifier Entered\n");
    	subdev_notifier = v4l2_async_find_subdev_notifier(sd);
    	if (subdev_notifier)
    		v4l2_async_notifier_unbind_all_subdevs(subdev_notifier);
    
    	if (sd->asd)
    		v4l2_async_notifier_call_unbind(notifier, sd, sd->asd);
    	v4l2_async_cleanup(sd);
    
    	mutex_unlock(&list_lock);
    	dev_err(dev,"v4l2_async_register_subdev End\n");
    	return ret;
    }
    EXPORT_SYMBOL(v4l2_async_register_subdev);
    
    void v4l2_async_unregister_subdev(struct v4l2_subdev *sd)
    {
    	mutex_lock(&list_lock);
    
    	__v4l2_async_notifier_unregister(sd->subdev_notifier);
    	v4l2_async_notifier_cleanup(sd->subdev_notifier);
    	kfree(sd->subdev_notifier);
    	sd->subdev_notifier = NULL;
    
    	if (sd->asd) {
    		struct v4l2_async_notifier *notifier = sd->notifier;
    
    		list_add(&sd->asd->list, &notifier->waiting);
    
    		v4l2_async_notifier_call_unbind(notifier, sd, sd->asd);
    	}
    
    	v4l2_async_cleanup(sd);
    
    	mutex_unlock(&list_lock);
    }
    EXPORT_SYMBOL(v4l2_async_unregister_subdev);

    These two files i am referring sir,

    Thanking you,

    Regards,

    Ram

  • Hi,

    Can you please specify which API is causing the system to hang?

    Regards,
    Parth

  • Hi sir,

    After calling v4l2-async.c file v4l2_async_notifier_call_bound function it is not returning from here return n->ops->bound(n, subdev, asd); after calling this function i am getting vin3a: Port A: Using subdev gs2971 for capture then it will hang.

    Thanking you,

    Regards,

    Ramachndra

  • Hi Ramachandra,

    It is not possible to reproduce and debug this issue on our end and provide a straightforward solution. You have to debug this on your end, but we can definitely support you in the process. 
    Please check which operation in n->ops->bound is causing the hang. Without this information it is very difficult to figure out the issue here.

    Regards,
    Parth

  • Hi sir,

    Actually return n->ops->bound(n, subdev, asd); its hang i will go in deep

    thanking you,

    Regards,

    Ramachandra