mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-20 17:41:09 +00:00
media: atomisp: add a way for the driver to know the chipset version
The atomisp supports two different chipsets: ISP2400 and ISP2401. Right now, this is controlled by ugly #defines inside the driver. Add a global bolean to identify the type of hardware. While this is hacky, it would be a quick way to start removing the ugly ifdefs. Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
9a0d7fb5ec
commit
e1ac35b39a
2 changed files with 33 additions and 6 deletions
|
@ -69,6 +69,9 @@
|
|||
#define V4L2_MBUS_FMT_CUSTOM_M10MO_RAW 0x800b
|
||||
#endif
|
||||
|
||||
/* FIXME: for now, let's use a boolean to identify the type of atomisp chipset */
|
||||
extern bool atomisp_hw_is_isp2401;
|
||||
|
||||
/* Configuration used by Bayer noise reduction and YCC noise reduction */
|
||||
struct atomisp_nr_config {
|
||||
/* [gain] Strength of noise reduction for Bayer NR (Used by Bayer NR) */
|
||||
|
|
|
@ -105,6 +105,21 @@ int pad_h = 16;
|
|||
module_param(pad_h, int, 0644);
|
||||
MODULE_PARM_DESC(pad_h, "extra data for ISP processing");
|
||||
|
||||
/*
|
||||
* FIXME: this is a hack to make easier to support ISP2401 variant.
|
||||
* As a given system will either be ISP2401 or not, we can just use
|
||||
* a boolean, in order to replace existing #ifdef ISP2401 everywhere.
|
||||
*
|
||||
* Once this driver gets into a better shape, however, the best would
|
||||
* be to replace this to something stored inside atomisp allocated
|
||||
* structures.
|
||||
*/
|
||||
bool atomisp_hw_is_isp2401;
|
||||
|
||||
/* Types of atomisp hardware */
|
||||
#define HW_IS_ISP2400 0
|
||||
#define HW_IS_ISP2401 1
|
||||
|
||||
struct device *atomisp_dev;
|
||||
|
||||
void __iomem *atomisp_io_base;
|
||||
|
@ -1169,6 +1184,11 @@ static int atomisp_pci_probe(struct pci_dev *dev,
|
|||
/* Pointer to struct device. */
|
||||
atomisp_dev = &dev->dev;
|
||||
|
||||
if (id->driver_data == HW_IS_ISP2401)
|
||||
atomisp_hw_is_isp2401 = true;
|
||||
else
|
||||
atomisp_hw_is_isp2401 = false;
|
||||
|
||||
pdata = atomisp_get_platform_data();
|
||||
if (!pdata)
|
||||
dev_warn(&dev->dev, "no platform data available\n");
|
||||
|
@ -1514,18 +1534,22 @@ static void atomisp_pci_remove(struct pci_dev *dev)
|
|||
}
|
||||
|
||||
static const struct pci_device_id atomisp_pci_tbl[] = {
|
||||
/*
|
||||
* FIXME:
|
||||
* remove the ifs once we get rid of the ifs on other parts of the driver
|
||||
*/
|
||||
#if defined(ISP2400) || defined(ISP2400B0)
|
||||
/* Merrifield */
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1178)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1179)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x117a)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1178), .driver_data = HW_IS_ISP2400},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1179), .driver_data = HW_IS_ISP2400},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x117a), .driver_data = HW_IS_ISP2400},
|
||||
/* Baytrail */
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0f38)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x0f38), .driver_data = HW_IS_ISP2400},
|
||||
#elif defined(ISP2401)
|
||||
/* Anniedale (Merrifield+ / Moorefield) */
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1478)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x1478), .driver_data = HW_IS_ISP2401},
|
||||
/* Cherrytrail */
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x22b8)},
|
||||
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x22b8), .driver_data = HW_IS_ISP2401},
|
||||
#endif
|
||||
{0,}
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue