Commit 85df8457 authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

media: atomisp: better display DMI and EFI found entries

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: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 0d64e942
...@@ -1395,7 +1395,7 @@ static int ov2680_probe(struct i2c_client *client) ...@@ -1395,7 +1395,7 @@ static int ov2680_probe(struct i2c_client *client)
return -ENODEV; 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)); __func__, acpi_device_bid(adev), acpi_device_hid(adev));
dev = kzalloc(sizeof(*dev), GFP_KERNEL); dev = kzalloc(sizeof(*dev), GFP_KERNEL);
......
...@@ -1919,7 +1919,7 @@ static int ov5693_probe(struct i2c_client *client) ...@@ -1919,7 +1919,7 @@ static int ov5693_probe(struct i2c_client *client)
* some BIOS versions haven't gotten the memo. Work around * some BIOS versions haven't gotten the memo. Work around
* via config. * via config.
*/ */
i2c = gmin_get_var_int(&client->dev, "I2CAddr", -1); i2c = gmin_get_var_int(&client->dev, false, "I2CAddr", -1);
if (i2c != -1) { if (i2c != -1) {
dev_info(&client->dev, dev_info(&client->dev,
"Overriding firmware-provided I2C address (0x%x) with 0x%x\n", "Overriding firmware-provided I2C address (0x%x) with 0x%x\n",
......
...@@ -23,10 +23,12 @@ int atomisp_register_i2c_module(struct v4l2_subdev *subdev, ...@@ -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 v4l2_subdev *atomisp_gmin_find_subdev(struct i2c_adapter *adapter,
struct i2c_board_info *board_info); struct i2c_board_info *board_info);
int atomisp_gmin_remove_subdev(struct v4l2_subdev *sd); 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, int camera_sensor_csi(struct v4l2_subdev *sd, u32 port,
u32 lanes, u32 format, u32 bayer_order, int flag); 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, struct v4l2_subdev *subdev,
enum atomisp_input_format csi_format, enum atomisp_input_format csi_format,
enum atomisp_bayer_order csi_bayer); enum atomisp_bayer_order csi_bayer);
......
...@@ -1658,7 +1658,7 @@ static int atomisp_pci_probe(struct pci_dev *dev, ...@@ -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 /* HPLL frequency is known to be device-specific, but we don't
* have specs yet for exactly how it varies. Default to * have specs yet for exactly how it varies. Default to
* BYT-CR but let provisioning set it via EFI variable */ * 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); HPLL_FREQ_2000MHZ);
/* /*
......
...@@ -366,12 +366,12 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev) ...@@ -366,12 +366,12 @@ static struct gmin_subdev *gmin_subdev_add(struct v4l2_subdev *subdev)
pmic_id); pmic_id);
gmin_subdevs[i].subdev = subdev; 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.*/ /*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); VLV2_CLK_PLL_19P2MHZ);
gmin_subdevs[i].csi_port = gmin_get_var_int(dev, "CsiPort", 0); gmin_subdevs[i].csi_port = gmin_get_var_int(dev, false, "CsiPort", 0);
gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, "CsiLanes", 1); gmin_subdevs[i].csi_lanes = gmin_get_var_int(dev, false, "CsiLanes", 1);
/* get PMC clock with clock framework */ /* get PMC clock with clock framework */
snprintf(gmin_pmc_clk_name, snprintf(gmin_pmc_clk_name,
...@@ -500,9 +500,14 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on) ...@@ -500,9 +500,14 @@ static int gmin_v1p8_ctrl(struct v4l2_subdev *subdev, int on)
{ {
struct gmin_subdev *gs = find_gmin_subdev(subdev); struct gmin_subdev *gs = find_gmin_subdev(subdev);
int ret; int ret;
struct device *dev;
struct i2c_client *client = v4l2_get_subdevdata(subdev);
dev = &client->dev;
if (v1p8_gpio == V1P8_GPIO_UNSET) { 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) { if (v1p8_gpio != V1P8_GPIO_NONE) {
pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n", pr_info("atomisp_gmin_platform: 1.8v power on GPIO %d\n",
v1p8_gpio); v1p8_gpio);
...@@ -536,9 +541,14 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on) ...@@ -536,9 +541,14 @@ static int gmin_v2p8_ctrl(struct v4l2_subdev *subdev, int on)
{ {
struct gmin_subdev *gs = find_gmin_subdev(subdev); struct gmin_subdev *gs = find_gmin_subdev(subdev);
int ret; int ret;
struct device *dev;
struct i2c_client *client = v4l2_get_subdevdata(subdev);
dev = &client->dev;
if (v2p8_gpio == V2P8_GPIO_UNSET) { 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) { if (v2p8_gpio != V2P8_GPIO_NONE) {
pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n", pr_info("atomisp_gmin_platform: 2.8v power on GPIO %d\n",
v2p8_gpio); v2p8_gpio);
...@@ -697,7 +707,9 @@ static int gmin_get_hardcoded_var(struct gmin_cfg_var *varlist, ...@@ -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 * argument should be a device with an ACPI companion, as all
* configuration is based on firmware ID. * 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 *out, size_t *out_len)
{ {
char var8[CFG_VAR_NAME_MAX]; char var8[CFG_VAR_NAME_MAX];
...@@ -705,11 +717,12 @@ static int gmin_get_config_var(struct device *dev, const char *var, ...@@ -705,11 +717,12 @@ static int gmin_get_config_var(struct device *dev, const char *var,
struct efivar_entry *ev; struct efivar_entry *ev;
const struct dmi_system_id *id; const struct dmi_system_id *id;
int i, ret; int i, ret;
struct device *dev = maindev;
if (dev && ACPI_COMPANION(dev)) if (!is_gmin && ACPI_COMPANION(dev))
dev = &ACPI_COMPANION(dev)->dev; dev = &ACPI_COMPANION(dev)->dev;
if (dev) if (!is_gmin)
ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var); ret = snprintf(var8, sizeof(var8), "%s_%s", dev_name(dev), var);
else else
ret = snprintf(var8, sizeof(var8), "gmin_%s", var); ret = snprintf(var8, sizeof(var8), "gmin_%s", var);
...@@ -722,8 +735,10 @@ static int gmin_get_config_var(struct device *dev, const char *var, ...@@ -722,8 +735,10 @@ static int gmin_get_config_var(struct device *dev, const char *var,
* runtime. * runtime.
*/ */
id = dmi_first_match(gmin_vars); 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); return gmin_get_hardcoded_var(id->driver_data, var8, out, out_len);
}
/* Our variable names are ASCII by construction, but EFI names /* Our variable names are ASCII by construction, but EFI names
* are wide chars. Convert and zero-pad. * are wide chars. Convert and zero-pad.
...@@ -750,8 +765,11 @@ static int gmin_get_config_var(struct device *dev, const char *var, ...@@ -750,8 +765,11 @@ static int gmin_get_config_var(struct device *dev, const char *var,
if (ret == 0) { if (ret == 0) {
memcpy(out, ev->var.Data, ev->var.DataSize); memcpy(out, ev->var.Data, ev->var.DataSize);
*out_len = ev->var.DataSize; *out_len = ev->var.DataSize;
} else if (dev) { dev_info(maindev, "found EFI entry for '%s'\n", var8);
dev_warn(dev, "Failed to find gmin variable %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); kfree(ev);
...@@ -759,14 +777,14 @@ static int gmin_get_config_var(struct device *dev, const char *var, ...@@ -759,14 +777,14 @@ static int gmin_get_config_var(struct device *dev, const char *var,
return ret; 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]; char val[CFG_VAR_NAME_MAX];
size_t len = sizeof(val); size_t len = sizeof(val);
long result; long result;
int ret; int ret;
ret = gmin_get_config_var(dev, var, val, &len); ret = gmin_get_config_var(dev, is_gmin, var, val, &len);
if (!ret) { if (!ret) {
val[len] = 0; val[len] = 0;
ret = kstrtol(val, 0, &result); ret = kstrtol(val, 0, &result);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment