/* Sysfs accessors */ static ssize_t nvsd_settings_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct device *dev = container_of((kobj->parent), struct device, kobj); struct nvhost_device *ndev = to_nvhost_device(dev); struct tegra_dc *dc = nvhost_get_drvdata(ndev); struct tegra_dc_sd_settings *sd_settings = dc->out->sd_settings; ssize_t res = 0; if (sd_settings) { if (IS_NVSD_ATTR(enable)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->enable); else if (IS_NVSD_ATTR(aggressiveness)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->aggressiveness); else if (IS_NVSD_ATTR(bin_width)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->bin_width); else if (IS_NVSD_ATTR(hw_update_delay)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->hw_update_delay); else if (IS_NVSD_ATTR(use_vid_luma)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->use_vid_luma); else if (IS_NVSD_ATTR(coeff)) res = snprintf(buf, PAGE_SIZE, "R: %d / G: %d / B: %d\n", sd_settings->coeff.r, sd_settings->coeff.g, sd_settings->coeff.b); else if (IS_NVSD_ATTR(blp_time_constant)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->blp.time_constant); else if (IS_NVSD_ATTR(blp_step)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->blp.step); else if (IS_NVSD_ATTR(fc_time_limit)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->fc.time_limit); else if (IS_NVSD_ATTR(fc_threshold)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->fc.threshold); else if (IS_NVSD_ATTR(lut)) res = nvsd_lut_show(sd_settings, buf, res); else if (IS_NVSD_ATTR(bltf)) res = nvsd_bltf_show(sd_settings, buf, res); else res = -EINVAL; } else { /* This shouldn't be reachable. But just in case... */ res = -EINVAL; } return res; }
/* Sysfs accessors */ static ssize_t nvsd_settings_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct device *dev = container_of((kobj->parent), struct device, kobj); struct nvhost_device *ndev = to_nvhost_device(dev); struct tegra_dc *dc = nvhost_get_drvdata(ndev); struct tegra_dc_sd_settings *sd_settings = dc->out->sd_settings; ssize_t res = 0; if (sd_settings) { if (IS_NVSD_ATTR(enable)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->enable); else if (IS_NVSD_ATTR(aggressiveness)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->aggressiveness); else if (IS_NVSD_ATTR(phase_in_settings)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->phase_in_settings); else if (IS_NVSD_ATTR(phase_in_adjustments)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->phase_in_adjustments); else if (IS_NVSD_ATTR(bin_width)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->bin_width); else if (IS_NVSD_ATTR(hw_update_delay)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->hw_update_delay); else if (IS_NVSD_ATTR(use_vid_luma)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->use_vid_luma); else if (IS_NVSD_ATTR(coeff)) res = snprintf(buf, PAGE_SIZE, "R: %d / G: %d / B: %d\n", sd_settings->coeff.r, sd_settings->coeff.g, sd_settings->coeff.b); else if (IS_NVSD_ATTR(blp_time_constant)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->blp.time_constant); else if (IS_NVSD_ATTR(blp_step)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->blp.step); else if (IS_NVSD_ATTR(fc_time_limit)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->fc.time_limit); else if (IS_NVSD_ATTR(fc_threshold)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->fc.threshold); #ifdef CONFIG_TEGRA_SD_GEN2 else if (IS_NVSD_ATTR(k_limit_enable)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->k_limit_enable); else if (IS_NVSD_ATTR(k_limit)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->k_limit); else if (IS_NVSD_ATTR(sd_window_enable)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->sd_window_enable); else if (IS_NVSD_ATTR(sd_window)) res = snprintf(buf, PAGE_SIZE, "x: %d, y: %d, w: %d, h: %d\n", sd_settings->sd_window.h_position, sd_settings->sd_window.v_position, sd_settings->sd_window.h_size, sd_settings->sd_window.v_size); else if (IS_NVSD_ATTR(soft_clipping_enable)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->soft_clipping_enable); else if (IS_NVSD_ATTR(soft_clipping_threshold)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->soft_clipping_threshold); else if (IS_NVSD_ATTR(smooth_k_enable)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->smooth_k_enable); else if (IS_NVSD_ATTR(smooth_k_incr)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->smooth_k_incr); else if (IS_NVSD_ATTR(use_vpulse2)) res = snprintf(buf, PAGE_SIZE, "%d\n", sd_settings->use_vpulse2); #endif else if (IS_NVSD_ATTR(lut)) res = nvsd_lut_show(sd_settings, buf, res); else if (IS_NVSD_ATTR(bltf)) res = nvsd_bltf_show(sd_settings, buf, res); else res = -EINVAL; } else { /* This shouldn't be reachable. But just in case... */ res = -EINVAL; } return res; }