]> git.baikalelectronics.ru Git - kernel.git/commitdiff
media: atomisp: better display DMI and EFI found entries
authorMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Sun, 10 May 2020 11:39:18 +0000 (13:39 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Wed, 20 May 2020 12:51:28 +0000 (14:51 +0200)
There are several device-specific data that are obtained
either via DMI or EFI, with changes the driver's behavior.

Display what has been detected, as such info may help
identifying troubles at the driver.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/staging/media/atomisp/i2c/atomisp-ov2680.c
drivers/staging/media/atomisp/i2c/ov5693/atomisp-ov5693.c
drivers/staging/media/atomisp/include/linux/atomisp_gmin_platform.h
drivers/staging/media/atomisp/pci/atomisp_v4l2.c
drivers/staging/media/atomisp/platform/intel-mid/atomisp_gmin_platform.c

index 4f1e0d8df8e1019f50c1b099ce4077a92cf5ac78..4601cefde89bf379802708161f630515f3353195 100644 (file)
@@ -1395,7 +1395,7 @@ static int ov2680_probe(struct i2c_client *client)
                return -ENODEV;
        }
 
-       pr_info("%s: ACPI detected it on bus ID=%s, HID=%s\n",
+       dev_info(&client->dev, "%s: ACPI detected it on bus ID=%s, HID=%s\n",
                __func__, acpi_device_bid(adev), acpi_device_hid(adev));
 
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
index 6572e927cf9b6509b31561cab056999498183bd3..886f9fd0152f16e49de24c00147e0a4860ccfd09 100644 (file)
@@ -1919,7 +1919,7 @@ static int ov5693_probe(struct i2c_client *client)
         * some BIOS versions haven't gotten the memo.  Work around
         * via config.
         */
-       i2c = gmin_get_var_int(&client->dev, "I2CAddr", -1);
+       i2c = gmin_get_var_int(&client->dev, false, "I2CAddr", -1);
        if (i2c != -1) {
                dev_info(&client->dev,
                         "Overriding firmware-provided I2C address (0x%x) with 0x%x\n",
index 09e260ea06cac95b0e5fe0b87e939c79a24e1430..8700ffd32bdbebef895e5a7f0bc6ff194cc99ae8 100644 (file)
@@ -23,10 +23,12 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev,
 struct v4l2_subdev *atomisp_gmin_find_subdev(struct i2c_adapter *adapter,
        struct i2c_board_info *board_info);
 int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd);
-int gmin_get_var_int(struct device *dev, const char *var, int def);
+int gmin_get_var_int(struct device *dev, bool is_gmin,
+                    const char *var, int def);
 int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
                      u32 lanes, u32 format, u32 bayer_order, int flag);
-struct camera_sensor_platform_data *gmin_camera_platform_data(
+struct camera_sensor_platform_data *
+gmin_camera_platform_data(
     struct v4l2_subdev *subdev,
     enum atomisp_input_format csi_format,
     enum atomisp_bayer_order csi_bayer);
index d4e44a1a960144a45985f3a7939264f86b8a78d2..ae1585d99e74e7f02c2ec1c3027b5212693f9e4b 100644 (file)
@@ -1658,7 +1658,7 @@ static int atomisp_pci_probe(struct pci_dev *dev,
                /* HPLL frequency is known to be device-specific, but we don't
                 * have specs yet for exactly how it varies.  Default to
                 * BYT-CR but let provisioning set it via EFI variable */
-               isp->hpll_freq = gmin_get_var_int(&dev->dev, "HpllFreq",
+               isp->hpll_freq = gmin_get_var_int(&dev->dev, false, "HpllFreq",
                                                  HPLL_FREQ_2000MHZ);
 
                /*
index bdb4fdebacf55d49118182635f3647b280ffc901..722681e1ac6e84c78065e6390f79a35619f115c8 100644 (file)
@@ -366,12 +366,12 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
                 pmic_id);
 
        gmin_subdevs[i].subdev = subdev;
-       gmin_subdevs[i].clock_num = gmin_get_var_int(dev, "CamClk", 0);
+       gmin_subdevs[i].clock_num = gmin_get_var_int(dev, false, "CamClk", 0);
        /*WA:CHT requires XTAL clock as PLL is not stable.*/
-       gmin_subdevs[i].clock_src = gmin_get_var_int(dev, "ClkSrc",
+       gmin_subdevs[i].clock_src = gmin_get_var_int(dev, false, "ClkSrc",
                                    VLV2_CLK_PLL_19P2MHZ);
-       gmin_subdevs[i].csi_port = gmin_get_var_int(dev, "CsiPort", 0);
-       gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, "CsiLanes", 1);
+       gmin_subdevs[i].csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);
+       gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);
 
        /* get PMC clock with clock framework */
        snprintf(gmin_pmc_clk_name,
@@ -500,9 +500,14 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)
 {
        struct gmin_subdev *gs = find_gmin_subdev(subdev);
        int ret;
+       struct device *dev;
+       struct i2c_client *client = v4l2_get_subdevdata(subdev);
+
+       dev = &client->dev;
 
        if (v1p8_gpio == V1P8_GPIO_UNSET) {
-               v1p8_gpio = gmin_get_var_int(NULL, "V1P8GPIO", V1P8_GPIO_NONE);
+               v1p8_gpio = gmin_get_var_int(dev, true,
+                                            "V1P8GPIO", V1P8_GPIO_NONE);
                if (v1p8_gpio != V1P8_GPIO_NONE) {
                        pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n",
                                v1p8_gpio);
@@ -536,9 +541,14 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
 {
        struct gmin_subdev *gs = find_gmin_subdev(subdev);
        int ret;
+       struct device *dev;
+       struct i2c_client *client = v4l2_get_subdevdata(subdev);
+
+       dev = &client->dev;
 
        if (v2p8_gpio == V2P8_GPIO_UNSET) {
-               v2p8_gpio = gmin_get_var_int(NULL, "V2P8GPIO", V2P8_GPIO_NONE);
+               v2p8_gpio = gmin_get_var_int(dev, true,
+                                            "V2P8GPIO", V2P8_GPIO_NONE);
                if (v2p8_gpio != V2P8_GPIO_NONE) {
                        pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",
                                v2p8_gpio);
@@ -697,7 +707,9 @@ static int gmin_get_hardcoded_var(struct gmin_cfg_var *varlist,
  * argument should be a device with an ACPI companion, as all
  * configuration is based on firmware ID.
  */
-static int gmin_get_config_var(struct device *dev, const char *var,
+static int gmin_get_config_var(struct device *maindev,
+                              bool is_gmin,
+                              const char *var,
                               char *out, size_t *out_len)
 {
        char var8[CFG_VAR_NAME_MAX];
@@ -705,11 +717,12 @@ static int gmin_get_config_var(struct device *dev, const char *var,
        struct efivar_entry *ev;
        const struct dmi_system_id *id;
        int i, ret;
+       struct device *dev = maindev;
 
-       if (dev && ACPI_COMPANION(dev))
+       if (!is_gmin && ACPI_COMPANION(dev))
                dev = &ACPI_COMPANION(dev)->dev;
 
-       if (dev)
+       if (!is_gmin)
                ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var);
        else
                ret = snprintf(var8, sizeof(var8), "gmin_%s", var);
@@ -722,8 +735,10 @@ static int gmin_get_config_var(struct device *dev, const char *var,
         * runtime.
         */
        id = dmi_first_match(gmin_vars);
-       if (id)
+       if (id) {
+               dev_info(maindev, "Found DMI entry for '%s'\n", var8);
                return gmin_get_hardcoded_var(id->driver_data, var8, out, out_len);
+       }
 
        /* Our variable names are ASCII by construction, but EFI names
         * are wide chars.  Convert and zero-pad.
@@ -750,8 +765,11 @@ static int gmin_get_config_var(struct device *dev, const char *var,
        if (ret == 0) {
                memcpy(out, ev->var.Data, ev->var.DataSize);
                *out_len = ev->var.DataSize;
-       } else if (dev) {
-               dev_warn(dev, "Failed to find gmin variable %s\n", var8);
+               dev_info(maindev, "found EFI entry for '%s'\n", var8);
+       } else if (is_gmin) {
+               dev_warn(maindev, "Failed to find gmin variable %s\n", var8);
+       } else {
+               dev_warn(maindev, "Failed to find variable %s\n", var8);
        }
 
        kfree(ev);
@@ -759,14 +777,14 @@ static int gmin_get_config_var(struct device *dev, const char *var,
        return ret;
 }
 
-int gmin_get_var_int(struct device *dev, const char *var, int def)
+int gmin_get_var_int(struct device *dev, bool is_gmin, const char *var, int def)
 {
        char val[CFG_VAR_NAME_MAX];
        size_t len = sizeof(val);
        long result;
        int ret;
 
-       ret = gmin_get_config_var(dev, var, val, &len);
+       ret = gmin_get_config_var(dev, is_gmin, var, val, &len);
        if (!ret) {
                val[len] = 0;
                ret = kstrtol(val, 0, &result);